-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial commit, to kill the last repositorie
- Loading branch information
0 parents
commit b5a6e73
Showing
1,128 changed files
with
425,244 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include <iostream> | ||
#include <stdio.h> | ||
#include <string.h> | ||
|
||
using namespace std; | ||
|
||
int main() { | ||
int a, b; | ||
while(scanf("%d %d", &a, &b) != EOF) { | ||
cout << (a + b) << endl; | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include <iostream> | ||
#include <stdio.h> | ||
|
||
using namespace std; | ||
|
||
int x1, x2, x3, xp, y1, y2, y3, yp; | ||
|
||
bool sameSide() | ||
|
||
int main(void) { | ||
while(~scanf("%e%e%e%e%e%e%e%e", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp)) { | ||
|
||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import java.util.*; | ||
|
||
public class AizuPR { | ||
public static void main(String[] args) throws Exception { | ||
Scanner input = new Scanner(System.in); | ||
|
||
int N = Integer.parseInt(input.nextLine()); | ||
|
||
for(int i = 0; i < N; i++) { | ||
String s = input.nextLine().replaceAll("Hoshino", "Hoshina"); | ||
|
||
System.out.println(s); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#include <iostream> | ||
#include <stdio.h> | ||
#include <string.h> | ||
|
||
using namespace std; | ||
|
||
int n, i, j, k, v, ok, maze[200][200], memo[200][200]; | ||
|
||
const int INF = 10000001; | ||
|
||
int main(void) { | ||
freopen("i.in", "r", stdin); | ||
while(1) { | ||
scanf("%d", &n); | ||
if(n == 0) break; | ||
|
||
ok = 0; | ||
memset(memo, 0, sizeof(memo)); | ||
|
||
for(i = 0; i < n; i++) { | ||
for(j = 0; j < n; j++) { | ||
scanf("%d", &maze[i][j]); | ||
} | ||
} | ||
|
||
for(i = 0; i < n; i++) { | ||
int m = INF; | ||
for(j = 0; j < n; j++) { | ||
if(maze[i][j] <= m) { | ||
m = maze[i][j]; | ||
} | ||
} | ||
for(j = 0; j < n; j++) { | ||
if(maze[i][j] == m) { | ||
memo[i][j] += 1; | ||
} | ||
} | ||
} | ||
|
||
for(j = 0; j < n; j++) { | ||
int m = -1; | ||
for(i = 0; i < n; i++) { | ||
if(maze[i][j] >= m) { | ||
m = maze[i][j]; | ||
} | ||
} | ||
for(i = 0; i < n; i++) { | ||
if(maze[i][j] == m) { | ||
memo[i][j] += 1; | ||
} | ||
} | ||
} | ||
|
||
for(i = 0; i < n; i++) { | ||
for(j = 0; j < n; j++) { | ||
if(memo[i][j] == 2) { | ||
v = maze[i][j]; | ||
ok = 1; | ||
} | ||
} | ||
} | ||
|
||
if(ok) { | ||
printf("%d\n", v); | ||
} else { | ||
printf("%d\n", 0); | ||
} | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#include <iostream> | ||
#include <vector> | ||
#include <algorithm> | ||
#include <math.h> | ||
#include <stdio.h> | ||
|
||
using namespace std; | ||
|
||
int maze[100][100]; | ||
|
||
int main(void) { | ||
int n, m; | ||
while(1) { | ||
scanf("%d", &n); | ||
if(n == 0) break; | ||
|
||
for(int i = 0; i < n; i++) { | ||
for(int j = 0; j < n; j++) { | ||
scanf("%d", &maze[i][j]); | ||
} | ||
} | ||
bool end = true; | ||
for(int i = 0; i < n; i++) { | ||
for(int j = 0; j < n; j++) { | ||
end = true; | ||
for(int k = 0; k < n; k++) { | ||
if(maze[i][k] < maze[i][j] || maze[k][j] > maze[i][j]) end = false; | ||
} | ||
if(end) { m = maze[i][j]; goto fim; } | ||
} | ||
} | ||
fim: | ||
printf("%d\n", m); | ||
continue; | ||
printf("0\n"); | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#include <iostream> | ||
#include <string> | ||
|
||
using namespace std; | ||
|
||
int n, p, c, o; | ||
string curr; | ||
|
||
int main(void) { | ||
cin >> n; | ||
|
||
while(n > 0) { | ||
p = o = c = 0; | ||
while(1) { | ||
cin >> curr; | ||
if(curr == "HOMERUN") { | ||
p += c + 1; | ||
c = 0; | ||
} else if(curr == "OUT") { | ||
o += 1; | ||
} else { | ||
c += 1; | ||
if(c == 4) { | ||
p += 1; | ||
c -= 1; | ||
} | ||
} | ||
if(o == 3) break; | ||
} | ||
cout << p << endl; | ||
n--; | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#include <iostream> | ||
#include <vector> | ||
#include <algorithm> | ||
#include <map> | ||
#include <utility> | ||
#include <stdio.h> | ||
|
||
using namespace std; | ||
|
||
struct Page { | ||
string name; | ||
vector<int> p; | ||
|
||
Page(string _name, int v) { | ||
name = _name; | ||
p = vector<int>(); | ||
p.push_back(v); | ||
} | ||
|
||
bool operator<(const Page& p) const { | ||
return name < p.name; | ||
} | ||
}; | ||
|
||
vector<Page> v; | ||
|
||
int main(void) { | ||
string style; | ||
|
||
v.clear(); | ||
|
||
int i, j, page; | ||
while(cin >> style >> page) { | ||
int index = -1; | ||
for(i = 0; i < (int) v.size(); i++) { | ||
if(v[i].name == style) { | ||
index = i; | ||
v[i].p.push_back(page); | ||
break; | ||
} | ||
} | ||
if(index == -1) { | ||
v.push_back(Page(style, page)); | ||
} | ||
} | ||
sort(v.begin(), v.end()); | ||
|
||
for(i = 0; i < (int) v.size(); i++) { | ||
cout << v[i].name << endl; | ||
sort(v[i].p.begin(), v[i].p.end()); | ||
for(j = 0; j < (int) v[i].p.size() - 1; j++) { | ||
cout << v[i].p[j] << " "; | ||
} | ||
cout << v[i].p[j] << endl; | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include <stdio.h> | ||
|
||
int i, j, n, v[110]; | ||
|
||
int main(void) { | ||
scanf("%d", &n); | ||
for(i = 0; i < n; i++) { | ||
scanf("%d", &v[i]); | ||
} | ||
int swaps = 0; | ||
for(i = 0; i <= n; i++) { | ||
for(j = n; j >= i + 1; j--) { | ||
if(v[j] < v[j - 1]) { | ||
swaps++; | ||
int tmp = v[j]; | ||
v[j] = v[j - 1]; | ||
v[j - 1] = tmp; | ||
} | ||
} | ||
} | ||
for(i = 1; i <= n; i++) { | ||
printf("%d ", v[i]); | ||
} | ||
printf("\n%d\n", swaps); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include <iostream> | ||
#include <cctype> | ||
|
||
using namespace std; | ||
|
||
string g; | ||
|
||
int main(void) { | ||
getline(cin, g); | ||
|
||
for(int i = 0; i < (int) g.size(); i++) { | ||
if(g[i] >= 'a' && g[i] <= 'z') { | ||
g[i] = toupper(g[i]); | ||
} | ||
} | ||
cout << g << endl; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
#include <iostream> | ||
#include <string> | ||
#include <sstream> | ||
#include <vector> | ||
#include <set> | ||
#include <map> | ||
#include <list> | ||
#include <queue> | ||
#include <stack> | ||
#include <memory> | ||
#include <iomanip> | ||
#include <functional> | ||
#include <new> | ||
#include <algorithm> | ||
#include <cmath> | ||
#include <cstring> | ||
#include <cstdlib> | ||
#include <cstdio> | ||
#include <climits> | ||
#include <cctype> | ||
#include <ctime> | ||
|
||
#define REP(i, n) for((i) = 0; i < n; i++) | ||
#define FOR(i, a, n) for((i) = a; i < n; i++) | ||
#define FORR(i, a, n) for((i) = a; i <= n; i++) | ||
#define for_each(q, s) for(typeof(s.begin()) q=s.begin(); q!=s.end(); q++) | ||
#define sz(n) n.size() | ||
#define pb(n) push_back(n) | ||
#define all(n) n.begin(), n.end() | ||
|
||
using namespace std; | ||
|
||
typedef long long ll; | ||
typedef long double ld; | ||
|
||
const int MAXN = 18; | ||
int i, j, ans, N, M, vis[MAXN][MAXN]; | ||
char mp[MAXN][MAXN]; | ||
|
||
int dx[8] = {-1,-1,0,1,1,1,0,-1}; | ||
int dy[8] = {0,1,1,1,0,-1,-1,-1}; | ||
|
||
bool ok(int i, int j) { | ||
return i >= 0 && j >= 0 && i < N && j < M; | ||
} | ||
|
||
int func(int i, int j) { | ||
vis[i][j] = 1; | ||
int k, all = mp[i][j] - '0'; | ||
REP(k, 8) { | ||
int ii = i + dx[k]; | ||
int jj = j + dy[k]; | ||
|
||
if(ok(ii, jj) && mp[ii][jj] == '*') { | ||
if(vis[ii][jj]) { | ||
all -= 1; | ||
} else { | ||
vis[ii][jj] = 1; | ||
} | ||
} | ||
} | ||
return all; | ||
} | ||
|
||
int main(void) { | ||
freopen("i.in", "r", stdin); | ||
while(2 == scanf("%d%d", &N, &M) && N + M != 0) { | ||
REP(i, N) { | ||
scanf("%s", mp[i]); | ||
} | ||
memset(vis, 0, sizeof(vis)); | ||
ans = 0; | ||
REP(i, N) REP(j, M) { | ||
if(mp[i][j] >= '0' && mp[i][j] <= '9') { | ||
ans += func(i, j); | ||
} | ||
} | ||
printf("%d\n", ans); | ||
} | ||
return 0; | ||
} | ||
|
Oops, something went wrong.