buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
change_count
int64
0
100
#include <iostream> using namespace std; main() { int n; int w; cin >> n; for (int i = 0; i < n; i++) { cin >> w; cout << "case " << i + 1 << ":" << endl; for (int j = 0; j < 10; j++) { w = w * w; w /= 100; w = w % 10000; cout << w << endl; } } }
#include <iostream> using namespace std; main() { int n; int w; cin >> n; for (int i = 0; i < n; i++) { cin >> w; cout << "Case " << i + 1 << ":" << endl; for (int j = 0; j < 10; j++) { w = w * w; w /= 100; w = w % 10000; cout << w << endl; } } }
[["-", 31, 16, 31, 16, 31, 16, 12, 5, 0, 6], ["+", 31, 16, 31, 16, 31, 16, 12, 5, 0, 6]]
1
95
2
#include <iostream> using namespace std; int main() { int s, n; cin >> n; for (int i = 0; i < n; i++) { cin >> s; cout << "case " << i + 1 << ":\n"; for (int k = 0; k < 10; k++) { s = s * s; s /= 100; s %= 10000; cout << s << endl; } } }
#include <iostream> using namespace std; int main() { long long s, n; cin >> n; for (int i = 0; i < n; i++) { cin >> s; cout << "Case " << i + 1 << ":\n"; for (int k = 0; k < 10; k++) { s = s * s; s /= 100; s %= 10000; cout << s << endl; } } }
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 16, 31, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 16, 31, 16, 31, 16, 12, 5, 0, 6]]
1
92
5
#include <iostream> using namespace std; int main() { int num; int s; int rand; cin >> num; for (int i = 0; i < num; i++) { cin >> s; cout << "Case " << i + 1 << endl; rand = s; for (int j = 0; j < 10; j++) { rand = rand * rand; if (rand >= 1000000) rand %= 1000...
#include <iostream> using namespace std; int main() { int num; int s; int rand; cin >> num; for (int i = 0; i < num; i++) { cin >> s; cout << "Case " << i + 1 << ":" << endl; rand = s; for (int j = 0; j < 10; j++) { rand = rand * rand; if (rand >= 1000000) rand ...
[["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 62], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 7, 8, 9, 0, 1, 0, 16, 17, 151]]
1
106
4
#include <cmath> #include <iostream> using namespace std; int main() { int n; cin >> n; for (int i = 1; i <= n; i++) { int a; cin >> a; cout << "Case" << i << ":" << endl; for (int j = 0; j < 10; j++) { a *= a; a = a / 100; int tmp = a / 10000 * 10000; a = a - tmp; c...
#include <cmath> #include <iostream> using namespace std; int main() { int n; cin >> n; for (int i = 1; i <= n; i++) { int a; cin >> a; cout << "Case " << i << ":" << endl; for (int j = 0; j < 10; j++) { a *= a; a = a / 100; int tmp = a / 10000 * 10000; a = a - tmp; ...
[["-", 31, 16, 31, 16, 31, 16, 12, 5, 0, 6], ["+", 31, 16, 31, 16, 31, 16, 12, 5, 0, 6]]
1
108
2
#include <stdio.h> int rand(int s); int main() { int i, s, j, n; int a[8]; scanf("%d", &n); j = n; while (n--) { scanf("%d", &s); printf("case %d:\n", j - n); for (i = 0; i < 10; i++) { s = rand(s); printf("%d\n", s); } } return 0; } int rand(int s) { int i, r = 0; s *= s...
#include <stdio.h> int rand(int s); int main() { int i, s, j, n; int a[8]; scanf("%d", &n); j = n; while (n--) { scanf("%d", &s); printf("Case %d:\n", j - n); for (i = 0; i < 10; i++) { s = rand(s); printf("%d\n", s); } } return 0; } int rand(int s) { int i, r = 0; s *= s...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
164
2
#include <iostream> using namespace std; int main() { int n; cin >> n; for (int dataset = 0; dataset < n; dataset++) { int rand; cin >> rand; cout << "Case " << dataset << ':' << endl; for (int i = 0; i < 10; i++) { rand = rand * rand; rand = rand / 100 - (rand / 1000000) * 10000; ...
#include <iostream> using namespace std; int main() { int n; cin >> n; for (int dataset = 0; dataset < n; dataset++) { int rand; cin >> rand; cout << "Case " << dataset + 1 << ':' << endl; for (int i = 0; i < 10; i++) { rand = rand * rand; rand = rand / 100 - (rand / 1000000) * 10000;...
[["+", 0, 16, 31, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 16, 31, 16, 31, 16, 12, 16, 12, 13]]
1
98
2
#include <iostream> using namespace std; int rand(int a) { return a = a * a / 100 - a * a / 1000000 * 10000; } int main() { int d, l; cin >> d; for (int i = 1; i <= d; i++) { cin >> l; cout << "case " << i << ":" << endl; for (int j = 0; j < 10; j++) { l = rand(l); cout << l << endl; ...
#include <iostream> using namespace std; int rand(int a) { return a = a * a / 100 - a * a / 1000000 * 10000; } int main() { int d, l; cin >> d; for (int i = 1; i <= d; i++) { cin >> l; cout << "Case " << i << ":" << endl; for (int j = 0; j < 10; j++) { l = rand(l); cout << l << endl; ...
[["-", 31, 16, 31, 16, 31, 16, 12, 5, 0, 6], ["+", 31, 16, 31, 16, 31, 16, 12, 5, 0, 6]]
1
109
2
#include <iostream> using namespace std; int main(void) { int n, m; cin >> m; for (int i = 1; i <= m; i++) { cin >> n; cout << "case " << i << ":" << endl; for (int j = 0; j < 10; j++) { n = n * n; n = ((n % 1000000) / 100); cout << n << endl; } } }
#include <iostream> using namespace std; int main(void) { int n, m; cin >> m; for (int i = 1; i <= m; i++) { cin >> n; cout << "Case " << i << ":" << endl; for (int j = 0; j < 10; j++) { n = n * n; n = ((n % 1000000) / 100); cout << n << endl; } } }
[["-", 31, 16, 31, 16, 31, 16, 12, 5, 0, 6], ["+", 31, 16, 31, 16, 31, 16, 12, 5, 0, 6]]
1
96
2
#include <algorithm> #include <iostream> #include <sstream> #include <string> using namespace std; int main() { int n; cin >> n; for (int i = 1; i <= n; i++) { int in; cin >> in; cout << "Case" << " " << i << endl; for (int j = 0; j < 10; j++) { in *= in; in = in % 1000000; ...
#include <algorithm> #include <iostream> #include <sstream> #include <string> using namespace std; int main() { int n; cin >> n; for (int i = 1; i <= n; i++) { int in; cin >> in; cout << "Case" << " " << i << ":" << endl; for (int j = 0; j < 10; j++) { in *= in; in = in % 1000...
[["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 62], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 7, 8, 9, 0, 1, 0, 16, 17, 151]]
1
98
4
#include <cstdio> #include <iostream> using namespace std; int main() { int n; int s; cin >> n; for (int i = 0; i < n; i++) { cin >> s; cout << "Case" << i + 1 << ":" << endl; for (int i = 0; i < 10; i++) { s *= s; s /= 100; s %= 10000; cout << s << endl; } } }
#include <cstdio> #include <iostream> using namespace std; int main() { int n; int s; cin >> n; for (int i = 0; i < n; i++) { cin >> s; cout << "Case " << i + 1 << ":" << endl; for (int i = 0; i < 10; i++) { s *= s; s /= 100; s %= 10000; cout << s << endl; } } }
[["-", 31, 16, 31, 16, 31, 16, 12, 5, 0, 6], ["+", 31, 16, 31, 16, 31, 16, 12, 5, 0, 6]]
1
94
2
k = int(input()) for j in range(k): x = int(input()) print(("Case " + str(k + 1))) for i in range(10): x = "00000000" + str(x**2) x = int(x[-6:-2]) print(x)
n = int(input()) for j in range(n): x = int(input()) print(("Case " + str(j + 1) + ":")) for i in range(10): x = "00000000" + str(x**2) x = int(x[-6:-2]) print(x)
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["-", 0, 657, 12, 652, 3, 4, 0, 657, 31, 22], ["+", 31, 657, 12, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 652, 3, 4, 0, 23, 0, 657, 17, 72], ["+", ...
5
76
10
n = int(input()) for i in range(n): s = int(input()) print("Case {}:".format(i+1)) for _ in range(10): s = int("{:08d}".format(s ** 2)[2:7]) print(s)
n = int(input()) for i in range(n): s = int(input()) print("Case {}:".format(i+1)) for _ in range(10): s = int("{:08d}".format(s ** 2)[2:6]) print(s)
[["-", 12, 652, 3, 4, 0, 206, 206, 663, 0, 612], ["+", 12, 652, 3, 4, 0, 206, 206, 663, 0, 612]]
5
69
2
import sys R = lambda:list(map(int,input().split())) digit = 4 n = int(input()) for i in range(n): s = int(input()) ran = [] for j in range(10): s2 = str(s*s) s2 = s2.zfill(8) #print s2 s = int(s2[digit-2:digit+2]) ran.append(s) print("Case %d" % (i+1)) for ...
import sys R = lambda:list(map(int,input().split())) digit = 4 n = int(input()) for i in range(n): s = int(input()) ran = [] for j in range(10): s2 = str(s*s) s2 = s2.zfill(8) #print s2 s = int(s2[digit-2:digit+2]) ran.append(s) print("Case %d:" % (i+1)) for...
[["-", 0, 652, 3, 4, 0, 657, 31, 557, 0, 6], ["+", 0, 652, 3, 4, 0, 657, 31, 557, 0, 6]]
5
128
2
#define _USE_MATH_DEFINES #include <algorithm> #include <cfloat> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; int main() { map<do...
#define _USE_MATH_DEFINES #include <algorithm> #include <cfloat> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; int main() { map<do...
[["-", 0, 1, 0, 16, 31, 16, 12, 69, 28, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 69, 28, 22]]
1
469
2
#include <algorithm> #include <iostream> using namespace std; #define MAX_N 8000 #define MAX_M 23994 pair<double, int> a[MAX_N]; pair<double, int> b[MAX_N]; pair<double, int> c[MAX_N]; pair<double, int> d[MAX_M]; void _cin(int p) { for (int i = 0; i < p; i++) { cin >> a[i].second >> a[i].first; } for (int ...
#include <algorithm> #include <iostream> using namespace std; #define MAX_N 8000 #define MAX_M 23994 pair<double, int> a[MAX_N]; pair<double, int> b[MAX_N]; pair<double, int> c[MAX_N]; pair<double, int> d[MAX_M]; void _cin(int p) { for (int i = 0; i < p; i++) { cin >> a[i].second >> a[i].first; } for (int ...
[["-", 0, 16, 31, 16, 12, 118, 28, 69, 28, 22], ["+", 0, 16, 31, 16, 12, 118, 28, 69, 28, 22], ["-", 0, 1, 0, 16, 12, 118, 28, 69, 28, 22], ["+", 0, 1, 0, 16, 12, 118, 28, 69, 28, 22]]
1
579
4
#define _USE_MATH_DEFINES #include <algorithm> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #defi...
#define _USE_MATH_DEFINES #include <algorithm> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #defi...
[["-", 31, 16, 12, 118, 28, 69, 341, 342, 0, 13], ["+", 31, 16, 12, 118, 28, 69, 341, 342, 0, 13]]
1
457
4
cat rb.rb sum = 0; n = gets.to_i n.times do sum += gets.to_i end puts sum/n
sum = 0; n = gets.to_i n.times do sum += gets.to_i end puts sum/n
[["-", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["-", 0, 493, 0, 652, 3, 4, 0, 652, 486, 22], ["-", 0, 493, 0, 652, 3, 4, 0, 652, 17, 131], ["-", 0, 493, 0, 652, 3, 4, 0, 652, 735, 22]]
4
27
4
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String ans[] = new String[n]; for (int i = 0; i < n; i++) { String s = sc.next(); String ss[] = s.split(":"); int h = Integer.parseInt(s...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String ans[] = new String[n]; for (int i = 0; i < n; i++) { String s = sc.next(); String ss[] = s.split(":"); int h = Integer.parseInt(s...
[["-", 75, 57, 15, 15, 0, 16, 12, 16, 12, 499], ["+", 75, 57, 15, 15, 0, 16, 12, 16, 12, 499]]
3
221
2
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for (int i = 0; i < n; i++) { String[] s = sc.next().split(":"); double a = Double.parseDouble(s[0]) * 60; double b = Double.parseDouble(s[1]) * 11;...
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for (int i = 0; i < n; i++) { String[] s = sc.next().split(":"); double a = Double.parseDouble(s[0]) * 60; double b = Double.parseDouble(s[1]) * 11;...
[["-", 3, 4, 0, 510, 75, 510, 15, 16, 31, 499], ["-", 3, 4, 0, 510, 75, 510, 15, 16, 17, 18], ["+", 3, 4, 0, 510, 75, 510, 15, 16, 17, 18], ["+", 3, 4, 0, 510, 75, 510, 15, 16, 12, 499]]
3
181
4
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for (int i = 0; i < n; i++) { String[] s = sc.next().split(":"); int c = Math.abs(Integer.parseInt(s[0]) * 120 - Integer.parseInt(s[1]) * 22); ...
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for (int i = 0; i < n; i++) { String[] s = sc.next().split(":"); int c = Math.abs(Integer.parseInt(s[0]) * 60 - Integer.parseInt(s[1]) * 11); ...
[["-", 51, 492, 3, 4, 0, 16, 31, 16, 12, 499], ["+", 51, 492, 3, 4, 0, 16, 31, 16, 12, 499], ["-", 51, 492, 3, 4, 0, 16, 12, 16, 12, 499], ["+", 51, 492, 3, 4, 0, 16, 12, 16, 12, 499]]
3
146
4
#include <stdio.h> int main() { int n, h, m; scanf("%d", &n); while (n--) { scanf("%d:%d", &h, &m); h = h * 300 + m; m *= 60; h = abs(h - m); if (h > 60 * 60 - h) h = 60 * 60 - h; if (h < 5 * 60) printf("alert\n"); else if (h < 15 * 60) printf("warning\n"); else /...
#include <stdio.h> int main() { int n, h, m; scanf("%d", &n); while (n--) { scanf("%d:%d", &h, &m); h = h * 300 + m * 5; m *= 60; h = abs(h - m); if (h > 60 * 60 - h) h = 60 * 60 - h; if (h < 5 * 60) printf("alert\n"); else if (h < 15 * 60) printf("warning\n"); el...
[["+", 0, 1, 0, 11, 12, 16, 12, 16, 17, 48], ["+", 0, 1, 0, 11, 12, 16, 12, 16, 12, 13]]
0
132
2
#define _CRT_SECURE_NO_WARNINGS //#define _USE_MATH_DEFINES #include <stdio.h> //#include<stdlib.h> #include <math.h> //#include<string.h> #define P(type, x) fprintf(stdout, "%" #type "\n", x) int main() { int h, m, n; double s, l, t, d; fscanf(stdin, "%d", &n); s = l = 0.0; while (n--) { fscanf(stdin, "%...
#define _CRT_SECURE_NO_WARNINGS //#define _USE_MATH_DEFINES #include <stdio.h> //#include<stdlib.h> #include <math.h> //#include<string.h> #define P(type, x) fprintf(stdout, "%" #type "\n", x) int main() { int h, m, n; double s, l, t, d; fscanf(stdin, "%d", &n); s = l = 0.0; while (n--) { fscanf(stdin, "%...
[["-", 0, 1, 0, 11, 12, 41, 64, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 41, 64, 16, 17, 72]]
0
173
2
#include <math.h> #include <stdio.h> int main() { int i, h, m, num; double l, s, d; scanf("%d", &num); for (i = 0; i < num; i++) { scanf("%d:%d", &h, &m); l = h * 30 + m * 0.5; s = m * 6; d = fabs(l - s); if (d > 180) { d = 360 - d; } if (90 <= d && d <= 180) { puts("saf...
#include <math.h> #include <stdio.h> int main() { int i, h, m, num; double l, s, d; scanf("%d", &num); for (i = 0; i < num; i++) { scanf("%d:%d", &h, &m); l = h * 30 + m * 0.5; s = m * 6; d = fabs(l - s); if (d > 180) { d = 360 - d; } if (90 <= d && d <= 180) { puts("saf...
[["-", 75, 76, 0, 57, 15, 23, 0, 91, 17, 111], ["-", 0, 57, 15, 23, 0, 91, 28, 23, 0, 24], ["-", 0, 91, 28, 23, 0, 16, 31, 16, 31, 13], ["+", 0, 57, 15, 23, 0, 16, 31, 16, 31, 13], ["-", 0, 91, 28, 23, 0, 16, 12, 16, 12, 13], ["-", 0, 57, 15, 23, 0, 91, 28, 23, 0, 25], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 12, 13]]
0
158
7
#include <stdio.h> int main() { int i; long long n = 0; int d, e = 0; double a, b, c = 0; scanf("%lld", &n); for (i = 0; i < n; i++) { scanf("%d:%d", &d, &e); a = (double)d * 30 + (double)e * 0.5; b = (double)e * 6; if ((b - a) >= 0 && 180 >= (b - a)) { c = b - a; } else if ((a - ...
#include <stdio.h> int main() { int i; long long n = 0; int d, e = 0; double a, b, c = 0; scanf("%lld", &n); for (i = 0; i < n; i++) { scanf("%d:%d", &d, &e); a = (double)d * 30 + (double)e * 0.5; b = (double)e * 6; if ((b - a) >= 0 && 180 >= (b - a)) { c = b - a; } else if ((a - ...
[["+", 0, 57, 15, 23, 0, 16, 31, 23, 0, 24], ["+", 0, 57, 15, 23, 0, 16, 31, 23, 0, 25], ["+", 0, 57, 75, 76, 0, 57, 15, 23, 0, 24], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
252
8
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <string> #include <vector> #define pb(in, tmp) in.push_back(tmp) #define loop(i, a, b) for (int i = a; i < b; i++) #define rep(i, b) loop(i, 0, b) #define all(in) in.begin(), in.end() const double PI = acos(-1); usin...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <string> #include <vector> #define pb(in, tmp) in.push_back(tmp) #define loop(i, a, b) for (int i = a; i < b; i++) #define rep(i, b) loop(i, 0, b) #define all(in) in.begin(), in.end() const double PI = acos(-1); usin...
[["-", 51, 2, 3, 4, 0, 16, 12, 16, 31, 13], ["+", 51, 2, 3, 4, 0, 16, 12, 16, 31, 13]]
1
158
2
#include <algorithm> #include <cmath> #include <cstdio> using namespace std; double ang(double a, double b) { return min(abs(a - b), 360 - abs(a - b)); } int main() { int n; for (scanf("%d", &n); n--;) { double a, b; scanf("%lf:%lf", &a, &b); a = a * 30 + b / 20; b = b * 6; if (ang(a, b) < 30)...
#include <algorithm> #include <cmath> #include <cstdio> using namespace std; double ang(double a, double b) { return min(abs(a - b), 360 - abs(a - b)); } int main() { int n; for (scanf("%d", &n); n--;) { double a, b; scanf("%lf:%lf", &a, &b); a = a * 30 + b / 2; b = b * 6; if (ang(a, b) < 30) ...
[["-", 0, 1, 0, 11, 12, 16, 12, 16, 12, 13], ["+", 0, 1, 0, 11, 12, 16, 12, 16, 12, 13]]
1
150
2
#include <math.h> #include <stdio.h> int main() { int n, i; scanf("%d", &n); for (i = 0; i < n; i++) { int h, m, x; scanf("%d:%d", &h, &m); x = fmod(5.5 * (60 * h + m), 360); if ((x >= 0 && x < 30) || x > 330) { printf("alert\n"); } else if (x >= 90 && x <= 270) { printf("safe\n");...
#include <math.h> #include <stdio.h> int main() { int n, i; scanf("%d", &n); for (i = 0; i < n; i++) { int h, m; double x; scanf("%d:%d", &h, &m); x = fmod(5.5 * (60 * h + m), 360); if ((x >= 0 && x < 30) || x > 330) { printf("alert\n"); } else if (x >= 90 && x <= 270) { printf...
[["-", 8, 9, 0, 7, 8, 9, 0, 43, 0, 21], ["+", 8, 9, 0, 7, 8, 9, 0, 43, 0, 35], ["+", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40]]
1
138
3
#include <cmath> #include <cstdio> #include <iostream> int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) { int h, m; scanf("%d:%d", &h, &m); long double ang; ang = 6 * m - (30 * h + 30 * ((long double)m / 60)); ang = std::abs(ang); if (ang > 180) ang -= 180; i...
#include <cmath> #include <cstdio> #include <iostream> int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) { int h, m; scanf("%d:%d", &h, &m); long double ang; ang = 6 * m - (30 * h + 30 * ((long double)m / 60)); ang = std::abs(ang); if (ang > 180) ang = 360 - ang; ...
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 17, 110], ["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 31, 13], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 17, 33], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 12, 22]]
1
155
6
#include <stdio.h> int main() { int n; double h, m; double g = 0, gm = 0; scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%lf:%lf", &h, &m); g = 30 * h; gm = 6 * m; g += (30 / 60 * m); double H = 0; H = gm - g; if (H < 0) H *= -1; if (H > 180) H = 360 - H; ...
#include <stdio.h> int main() { int n; double h, m; double g = 0, gm = 0; scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%lf:%lf", &h, &m); g = 30 * h; gm = 6 * m; g += (0.5 * m); double H = 0; H = gm - g; if (H < 0) H *= -1; if (H > 180) H = 360 - H; ...
[["-", 0, 11, 12, 23, 0, 16, 31, 16, 31, 13], ["-", 0, 11, 12, 23, 0, 16, 31, 16, 17, 85], ["-", 0, 11, 12, 23, 0, 16, 31, 16, 12, 13], ["+", 0, 1, 0, 11, 12, 23, 0, 16, 31, 13]]
1
166
4
#include <iomanip> #include <iostream> #include <list> #include <map> #include <math.h> #include <queue> #include <stack> #include <stdio.h> #include <string.h> #include <vector> #define range(i, a, b) for (int i = (a); i < (b); i++) #define rep(i, b) range(i, 0, b) #define debug(x) cout << "debug " << x << endl; using...
#include <iomanip> #include <iostream> #include <list> #include <map> #include <math.h> #include <queue> #include <stack> #include <stdio.h> #include <string.h> #include <vector> #define range(i, a, b) for (int i = (a); i < (b); i++) #define rep(i, b) range(i, 0, b) #define debug(x) cout << "debug " << x << endl; using...
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 17, 110], ["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 31, 13], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 17, 33], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 12, 22]]
1
187
6
#include <bits/stdc++.h> #define rep(i, l, n) for (int i = l; i < n; i++) #define rer(i, l, n) for (int i = l; i <= n; i++) #define all(a) a.begin(), a.end() #define o(a) cout << a << endl #define pb(a) push_back(a) #define mk(a, b) make_pair(a, b) #define fi first #define se second using namespace std; typedef long lo...
#include <bits/stdc++.h> #define rep(i, l, n) for (int i = l; i < n; i++) #define rer(i, l, n) for (int i = l; i <= n; i++) #define all(a) a.begin(), a.end() #define o(a) cout << a << endl #define pb(a) push_back(a) #define mk(a, b) make_pair(a, b) #define fi first #define se second using namespace std; typedef long lo...
[["-", 8, 9, 0, 9, 0, 1, 0, 2, 63, 22], ["-", 0, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 0, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 14, 8, 9, 0, 9, 0, 1, 0, 35]]
1
216
5
#include <cmath> #include <cstdio> #include <iostream> using namespace std; int a, b, n; double d, e, f; int main() { cin >> n; for (int i = 0; i < n; i++) { scanf("%d:%d", &a, &b); f = abs(a * 30 + b * 11.0 / 2.0); if (f > 180) { f = 360 - f; } if (f < 30) { cout << "alert" << endl;...
#include <cmath> #include <cstdio> #include <iostream> using namespace std; int a, b, n; double d, e, f; int main() { cin >> n; for (int i = 0; i < n; i++) { scanf("%d:%d", &a, &b); f = abs(a * 30 - b * 11.0 / 2.0); if (f > 180) { f = 360 - f; } if (f < 30) { cout << "alert" << endl;...
[["-", 0, 11, 12, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 17, 33]]
1
136
2
#include <bits/stdc++.h> using namespace std; int main() { int n, h, s; double a, b, ans; cin >> n; while (n--) { scanf("%d:%d", &h, &s); b = s * 6; a = h * 30 + b / 360; ans = abs(a - b); if (ans > 180) ans = 360 - ans; if (0 <= ans && ans < 30) cout << "alert" << endl; ...
#include <bits/stdc++.h> using namespace std; int main() { int n, h, s; double a, b, ans; cin >> n; while (n--) { scanf("%d:%d", &h, &s); b = s * 6; a = h * 30 + 30 * b / 360; ans = abs(a - b); if (ans > 180) ans = 360 - ans; if (0 <= ans && ans < 30) cout << "alert" << endl...
[["+", 0, 11, 12, 16, 12, 16, 31, 16, 31, 13], ["+", 0, 11, 12, 16, 12, 16, 31, 16, 17, 48]]
1
136
2
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iostream> #include <map> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #include...
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iostream> #include <map> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #include...
[["-", 0, 43, 49, 50, 51, 16, 12, 16, 12, 13], ["+", 0, 43, 49, 50, 51, 16, 12, 16, 12, 13]]
1
229
2
#include <algorithm> #include <cassert> #include <cctype> #include <complex> #include <cstdio> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; int n, h, m; char com; double s, l; int main() { cin >> n; w...
#include <algorithm> #include <cassert> #include <cctype> #include <complex> #include <cstdio> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; int n, h, m; char com; double s, l; int main() { cin >> n; w...
[["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 13], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 31, 13], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 12, 22]]
1
149
4
#include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #inclu...
#include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #inclu...
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
278
2
#include <algorithm> #include <cassert> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #include...
#include <algorithm> #include <cassert> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #include...
[["-", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["+", 0, 52, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 0, 52, 8, 9, 0, 43, 39, 86, 39, 40], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
232
5
#include <cstdio> #include <iostream> using namespace std; int different(double h, double m) { h += m / 120; double a = h - m; if (a < 0) a = -a; if (360 - a < a) a = 360 - a; return a; } int main(int argc, char const *argv[]) { double h, m; int n; cin >> n; for (int i = 0; i < n; i++)...
#include <cstdio> #include <iostream> using namespace std; int different(double h, double m) { h += m / 12; double a = h - m; if (a < 0) a = -a; if (360 - a < a) a = 360 - a; return a; } int main(int argc, char const *argv[]) { double h, m; int n; cin >> n; for (int i = 0; i < n; i++) ...
[["-", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
183
2
#include <algorithm> #include <cmath> #include <cstdlib> #include <iostream> #include <string> #include <vector> using namespace std; #define EPS (1e-10) #define EQ(a, b) (abs((a) - (b)) < EPS) int main() { int n; cin >> n; for (int i = 0; i < n; i++) { string str; double lg, sh; cin >> str; l...
#include <algorithm> #include <cmath> #include <cstdlib> #include <iostream> #include <string> #include <vector> using namespace std; #define EPS (1e-10) #define EQ(a, b) (abs((a) - (b)) < EPS) int main() { int n; cin >> n; for (int i = 0; i < n; i++) { string str; double lg, sh; cin >> str; l...
[["-", 0, 1, 0, 11, 12, 23, 0, 16, 12, 13], ["+", 0, 1, 0, 11, 12, 23, 0, 16, 12, 13]]
1
226
2
#include <algorithm> #include <bitset> #include <cfloat> #include <climits> #include <cmath> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; int main() {...
#include <algorithm> #include <bitset> #include <cfloat> #include <climits> #include <cmath> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; int main() {...
[["+", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 24], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 25]]
1
142
3
#include <cstdio> int main() { int n; scanf("%d", &n); while (n--) { int h, m; scanf("%d:%d", &h, &m); int diff = h * 300 - m * 55; if (diff < 0) diff *= -1; if (diff > 1800) diff = 3600 - diff; if (0 <= diff && diff <= 300) puts("alert"); else if (900 <= diff && di...
#include <cstdio> int main() { int n; scanf("%d", &n); while (n--) { int h, m; scanf("%d:%d", &h, &m); int diff = h * 300 - m * 55; if (diff < 0) diff *= -1; if (diff > 1800) diff = 3600 - diff; if (0 <= diff && diff < 300) puts("alert"); else if (900 <= diff && dif...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 19], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 18]]
1
125
2
#include <cmath> #include <iostream> #include <string> using namespace std; double degree(int h, int m) { double s = m * 6; double l = h * 30 + m * 0.5; double d = abs(l - s); if (d >= 180) d -= 180; return d; } string judge(int h, int m) { double d = degree(h, m); if (d < 30) return "alert"; ...
#include <cmath> #include <iostream> #include <string> using namespace std; double degree(int h, int m) { double s = m * 6; double l = h * 30 + m * 0.5; double d = abs(l - s); if (d > 180) d = 360 - d; return d; } string judge(int h, int m) { double d = degree(h, m); if (d < 30) return "alert"; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["-", 8, 9, 0, 57, 64, 1, 0, 11, 17, 110], ["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 31, 13], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 17, 33], ["+", 0, 57, 6...
1
161
8
#include <algorithm> #include <cmath> #include <cstring> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define REP(n) rep(i, n) #define all(n) n.begin(), n.end() int main() { int n; cin >> n; double h, m; char t; dou...
#include <algorithm> #include <cmath> #include <cstring> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define REP(n) rep(i, n) #define all(n) n.begin(), n.end() int main() { int n; cin >> n; double h, m; char t; dou...
[["-", 0, 11, 12, 16, 12, 16, 31, 16, 12, 13], ["+", 0, 11, 12, 16, 12, 16, 31, 16, 12, 13]]
1
178
2
#include <cstdio> #include <cstdlib> #include <iostream> using namespace std; int main(void) { int n; double h, m; double ans; scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%lf:%lf", &h, &m); h = h * 30 + m / 4; m = m * 6; if (h > m) ans = h - m; else ans = m - h; ...
#include <cstdio> #include <cstdlib> #include <iostream> using namespace std; int main(void) { int n; double h, m; double ans; scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%lf:%lf", &h, &m); h = h * 30 + m / 2; m = m * 6; if (h > m) ans = h - m; else ans = m - h; ...
[["-", 0, 1, 0, 11, 12, 16, 12, 16, 12, 13], ["+", 0, 1, 0, 11, 12, 16, 12, 16, 12, 13]]
1
151
2
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> using namespace std; #define fr first #define sc second #define INF 100 typedef pair<int, int> Pt; int main() { int n; double H, M, hh, mm, mini; scanf("%d", &n); while (n--) { scan...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> using namespace std; #define fr first #define sc second #define INF 100 typedef pair<int, int> Pt; int main() { int n; double H, M, hh, mm, mini; scanf("%d", &n); while (n--) { scan...
[["-", 0, 1, 0, 11, 12, 16, 12, 16, 12, 13], ["+", 0, 1, 0, 11, 12, 16, 12, 16, 12, 13]]
1
178
2
#include <iostream> #include <string> using namespace std; int main() { int n; while (cin >> n) { for (int i = 0; i < n; ++i) { int h, m; char dummy; cin >> h >> dummy >> m; int hAngle = h * 300 + m * 10 / 4; int mAngle = m * 10 * 360 / 60; int angle = hAngle > mAngle ? hA...
#include <iostream> #include <string> using namespace std; int main() { int n; while (cin >> n) { for (int i = 0; i < n; ++i) { int h, m; char dummy; cin >> h >> dummy >> m; int hAngle = h * 300 + m * 10 / 2; int mAngle = m * 10 * 360 / 60; int angle = hAngle > mAngle ? hA...
[["-", 0, 43, 49, 50, 51, 16, 12, 16, 12, 13], ["+", 0, 43, 49, 50, 51, 16, 12, 16, 12, 13]]
1
168
2
n = gets.chomp.to_i n.times do h, m = gets.chomp.split(':').map(&:to_f) diff = (h * 30 + m * 0.5 - m * 6).abs diff = 360 - diff if diff > 180 puts diff if diff < 30 puts :alert elsif diff < 90 puts :warning else puts :safe end end
n = gets.chomp.to_i n.times do h, m = gets.chomp.split(':').map(&:to_f) diff = (h * 30 + m * 0.5 - m * 6).abs diff = 360 - diff if diff > 180 if diff < 30 puts :alert elsif diff < 90 puts :warning else puts :safe end end
[["-", 0, 652, 196, 737, 8, 736, 0, 652, 735, 22], ["-", 196, 737, 8, 736, 0, 652, 3, 4, 0, 22]]
4
76
2
def angle(h, m) v = (30 * h + m/2.0 - 6 * m).abs v > 180 ? v - 180 : v end def to_msg(angle) if angle < 30 "alert" elsif angle >= 90 "safe" else "warning" end end gets.to_i.times do h, m = gets.split(":").map(&:to_i) puts to_msg(angle(h, m)) end
def angle(h, m) v = (30 * h + m/2.0 - 6 * m).abs v > 180 ? (v - 360).abs : v end def to_msg(angle) if angle < 30 "alert" elsif angle >= 90 "safe" else "warning" end end gets.to_i.times do h, m = gets.split(":").map(&:to_i) puts to_msg(angle(h, m)) end
[["+", 8, 736, 0, 754, 64, 652, 486, 739, 0, 24], ["-", 0, 735, 8, 736, 0, 754, 64, 738, 12, 612], ["+", 0, 754, 64, 652, 486, 739, 0, 738, 12, 612], ["+", 8, 736, 0, 754, 64, 652, 486, 739, 0, 25], ["+", 0, 735, 8, 736, 0, 754, 64, 652, 17, 131], ["+", 0, 735, 8, 736, 0, 754, 64, 652, 735, 22]]
4
94
6
n = eval(input()) for i in range(n): h,m = list(map(int, input().split(":"))) sangle = 1.0 * 360 * (h * 60 + m) / 720 langle = 1.0 * 360 * m / 60 angle = abs(sangle - langle) if angle > 180: angle = 360 - d if (0 <= angle < 30): print("alert") elif (90 <= angle <= 180): ...
n = eval(input()) for i in range(n): h,m = list(map(int, input().split(":"))) sangle = 1.0 * 360 * (h * 60 + m) / 720 langle = 1.0 * 360 * m / 60 angle = abs(sangle - langle) if angle > 180: angle = 360 - angle if (0 <= angle < 30): print("alert") elif (90 <= angle <= 180): ...
[["-", 64, 196, 0, 1, 0, 662, 12, 657, 12, 22], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 12, 22]]
5
118
2
for roop in range(int(input())): h,m = list(map(int,input().split(":"))) s = 60*h + m l = 24*m if l > s: l,s = s,l arg = l - s if l - s < 180*4 else 360*4-(l-s) if arg < 30*4: print("alert") elif arg < 90*4: print("warning") else : print("safe")
for roop in range(int(input())): h,m = list(map(int,input().split(":"))) s = 60*h + m l = 12*m if l < s: l,s = s,l arg = l - s if l - s < 180*2 else 360*2-(l-s) if arg < 30*2: print("alert") elif arg < 90*2: print("warning") else : print("safe")
[["-", 8, 196, 0, 1, 0, 662, 12, 657, 31, 612], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 31, 612], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18], ["-", 0, 662, 12, 41, 0, 666, 0, 657, 12, 612], ["+", 0, 662, 12, 41, 0, 666, 0, 657, 12, 612], ["-", 0, 662, 12, 41, 0, 657, 31, 657...
5
116
12
for _ in [0] * int(input()): a, b = list(map(int, input().split(':'))) b = b/60.0 x = abs((a+b)-b*12) if x>6: x=12-6 if x<1: print('alert') elif 3<=x: print('safe') else: print('warning')
for _ in [0] * int(input()): a, b = list(map(int, input().split(':'))) b = b/60.0 x = abs((a+b)-b*12) if x>6: x=12-x if x<1: print('alert') elif 3<=x: print('safe') else: print('warning')
[["-", 64, 196, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 12, 22]]
5
95
2
n=int(input()) for i in range(n): t=[int(x) for x in input().split(':')] longdeg=t[1]*360/60. shortdeg=t[0]*360/12.+t[1]*12/60. (longdeg,shortdeg)=(max(longdeg,shortdeg),min(longdeg,shortdeg)) dist=min(longdeg-shortdeg,360-(longdeg-shortdeg)) if dist<30: print('alert') elif dist>=90:...
n=int(input()) for i in range(n): t=[int(x) for x in input().split(':')] longdeg=t[1]*360/60. shortdeg=t[0]*360/12.+t[1]*30/60. (longdeg,shortdeg)=(max(longdeg,shortdeg),min(longdeg,shortdeg)) dist=min(longdeg-shortdeg,360-(longdeg-shortdeg)) if dist<30: print('alert') elif dist>=90:...
[["-", 0, 662, 12, 657, 12, 657, 31, 657, 12, 612], ["+", 0, 662, 12, 657, 12, 657, 31, 657, 12, 612]]
5
133
2
n=int(input()) t=[[int(num)for num in input().split(':')]for i in range(n)] for i in range(n): h=t[i][0] m=t[i][1] an_s=h*30+m/60 an_l=m*6 dif=0 if abs(an_s-an_l)<180:dif=abs(an_s-an_l) else:dif=360-abs(an_s-an_l) if dif<30: print("alert") elif dif<90: print("warning"...
n=int(input()) t=[[int(num)for num in input().split(':')]for i in range(n)] for i in range(n): h=t[i][0] m=t[i][1] an_s=h*30+m/2 an_l=m*6 dif=0 if abs(an_s-an_l)<180:dif=abs(an_s-an_l) else:dif=360-abs(an_s-an_l) if dif<30: print("alert") elif dif<90: print("warning")...
[["-", 0, 1, 0, 662, 12, 657, 12, 657, 12, 612], ["+", 0, 1, 0, 662, 12, 657, 12, 657, 12, 612]]
5
141
2
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0135 WA """ import sys from sys import stdin from math import sqrt, acos, cos, sin, radians, degrees input = stdin.readline def solve(time): # 12????????????90??? short_hand_angle = time[1] * -6 + 90 x_s = cos(radians(sho...
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0135 WA """ import sys from sys import stdin from math import sqrt, acos, cos, sin, radians, degrees input = stdin.readline def solve(time): # 12????????????90??? short_hand_angle = time[1] * -6 + 90 x_s = cos(radians(sho...
[["-", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 662, 12, 652, 3, 4, 0, 652, 63, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
243
7
# Clock Short Hand and Long Hand n = int(input()) for i in range(n): h, m = list(map(int, input().split(':'))) h *= 30.0 h += m * 0.5 m *= 6.0 d = abs(m - h) if d > 180: d = 360 - d print(d) if 0 <= d < 30: print("alert") elif 90 <= d <= 180: print("safe...
# Clock Short Hand and Long Hand n = int(input()) for i in range(n): h, m = list(map(int, input().split(':'))) h *= 30.0 h += m * 0.5 m *= 6.0 d = abs(m - h) if d > 180: d = 360 - d if 0 <= d < 30: print("alert") elif 90 <= d <= 180: print("safe") else: ...
[["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
106
4
import static java.util.Arrays.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Main { static void tr(Object... os) { System.err.println(deepToString(os)); } void...
import static java.util.Arrays.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Main { static void tr(Object... os) { System.err.println(deepToString(os)); } void...
[["+", 0, 492, 3, 4, 0, 16, 31, 23, 0, 24], ["+", 3, 4, 0, 16, 31, 23, 0, 16, 31, 499], ["+", 3, 4, 0, 16, 31, 23, 0, 16, 17, 72], ["+", 0, 492, 3, 4, 0, 16, 31, 23, 0, 25]]
3
621
4
import java.util.*; public class Main { public static void main(String[] args) throws java.io.IOException { Scanner scan = new Scanner(System.in); // Queue<Pair> fifo = new LinkedList<Pair>(); int rank[] = {0, 0, 0, 0, 0, 0}; // ArrayList <Double> mou =new ArrayList <Double>(); int c = scan.nextI...
import java.util.*; public class Main { public static void main(String[] args) throws java.io.IOException { Scanner scan = new Scanner(System.in); // Queue<Pair> fifo = new LinkedList<Pair>(); int rank[] = {0, 0, 0, 0, 0, 0}; // ArrayList <Double> mou =new ArrayList <Double>(); int c = scan.nextI...
[["+", 0, 492, 3, 4, 0, 16, 31, 16, 12, 499], ["+", 64, 1, 0, 492, 3, 4, 0, 16, 17, 72], ["+", 3, 4, 0, 16, 31, 16, 31, 16, 17, 72], ["+", 3, 4, 0, 16, 31, 16, 31, 16, 12, 499]]
3
247
4
import java.util.Scanner; public class Main { void io() { Scanner s = new Scanner(System.in); int n = s.nextInt(); int[] histgram = new int[6]; for (int i = 0; i < n; ++i) { double height = s.nextDouble(); if (height < 165.0) { ++histgram[0]; } else if (height < 170.0) { ...
import java.util.Scanner; public class Main { void io() { Scanner s = new Scanner(System.in); int n = s.nextInt(); int[] histgram = new int[6]; for (int i = 0; i < n; ++i) { double height = s.nextDouble(); if (height < 165.0) { ++histgram[0]; } else if (height < 170.0) { ...
[["-", 0, 492, 3, 4, 0, 16, 12, 5, 0, 491], ["+", 0, 492, 3, 4, 0, 16, 12, 5, 0, 491]]
3
253
2
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; const int MAX = 10000100; #define loop(i, a, b) for (int i = a; i < b; i++) #define rep(i, a) loop(i, 0, a) #define all(a) (a).begin(), (a).end() #defi...
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; const int MAX = 10000100; #define loop(i, a, b) for (int i = a; i < b; i++) #define rep(i, a) loop(i, 0, a) #define all(a) (a).begin(), (a).end() #defi...
[["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
241
4
#include <climits> #include <iostream> #include <memory> #include <vector> class Bus_stop { public: Bus_stop(const int &i) : id{i}, mins(10, INT_MAX - 1), prevs(10, nullptr) { mins.at(i) = 0; }; //?¬?????????????????¨???? void set_next(Bus_stop &other) { // this ?????? other ???????????????????????? ...
#include <climits> #include <iostream> #include <memory> #include <vector> class Bus_stop { public: Bus_stop(const int &i) : id{i}, mins(10, INT_MAX - 1), prevs(10, nullptr) { mins.at(i) = 0; }; //?¬?????????????????¨???? void set_next(Bus_stop &other) { // this ?????? other ???????????????????????? ...
[["-", 51, 2, 63, 118, 28, 2, 3, 4, 0, 22], ["+", 51, 2, 63, 118, 28, 2, 3, 4, 0, 13], ["-", 63, 118, 28, 2, 3, 4, 0, 16, 31, 13], ["-", 63, 118, 28, 2, 3, 4, 0, 16, 17, 33], ["-", 63, 118, 28, 2, 3, 4, 0, 16, 12, 22]]
1
890
6
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; using ld = long double; const ld eps = 1e-9; //// < "d:\d_download\visual studio ///2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual ///studio 2015\projects\programin...
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; using ld = long double; const ld eps = 1e-9; //// < "d:\d_download\visual studio ///2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual ///studio 2015\projects\programin...
[["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 72], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13]]
1
342
4
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <cstdlib> #include <cstring> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #includ...
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <cstdlib> #include <cstring> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #includ...
[["-", 0, 57, 64, 9, 0, 7, 15, 16, 17, 106], ["+", 0, 57, 64, 9, 0, 7, 15, 16, 17, 98]]
1
431
2
#include <iostream> using namespace std; int main(void) { int n; scanf("%d", &n); for (int i = 0; i < n; i++) { int f, t; scanf("%d%d", &f, &t); printf("%d", f); if (f <= 5) { if (t > f) { while (f != t) { f++; printf(" %d", f); } } if (t < f)...
#include <iostream> using namespace std; int main(void) { int n; scanf("%d", &n); for (int i = 0; i < n; i++) { int f, t; scanf("%d%d", &f, &t); printf("%d", f); if (f <= 5) { if (t > f) { while (f != t) { f++; printf(" %d", f); } } if (t < f)...
[["+", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95]]
1
332
1
#include <iostream> #include <string> using namespace std; string bus_stop = "012345678954321012345678954321"; void solve() { int n; cin >> n; while (n--) { char s, g; cin >> s >> g; string ans1, ans2; bool flag = false; int pos = 0; for (int i = 0; i < bus_stop.size(); ++i) { if (...
#include <iostream> #include <string> using namespace std; string bus_stop = "0123456789543210123456789543210123456789543210"; void solve() { int n; cin >> n; while (n--) { char s, g; cin >> s >> g; string ans1, ans2; bool flag = false; int pos = 0; for (int i = 0; i < bus_stop.size(); +...
[["-", 0, 30, 0, 43, 49, 50, 51, 5, 0, 6], ["+", 0, 30, 0, 43, 49, 50, 51, 5, 0, 6]]
1
314
2
function bomb(y, x, z) { if (yx[y][x] != "+") return; var dy = [ -1, 0, 1, 0 ]; var dx = [ 0, 1, 0, -1 ]; var Y = y + dy[z]; var X = x + dx[z]; if (Y < 0 || X < 0 || Y >= n || X >= n) { z = (z + 1) % 4; bomb(y, x, z); } else { if (yx[Y][X] == "#") { yx[Y - dy[z]][X - dx[z]] = "+"; ...
function bomb(y, x, z) { if (yx[y][x] != "+") return; var dy = [ -1, 0, 1, 0 ]; var dx = [ 0, 1, 0, -1 ]; var Y = y + dy[z]; var X = x + dx[z]; if (Y < 0 || X < 0 || Y >= n || X >= n) { z = (z + 1) % 4; bomb(y, x, z); } else { if (yx[Y][X] == "#") { yx[Y - dy[z]][X - dx[z]] = "+"; ...
[["-", 0, 493, 0, 7, 10, 198, 0, 200, 141, 22], ["+", 0, 493, 0, 7, 10, 198, 0, 200, 141, 22], ["-", 0, 493, 0, 7, 15, 1, 0, 16, 31, 22], ["+", 0, 493, 0, 7, 15, 1, 0, 16, 31, 22], ["-", 36, 36, 0, 493, 0, 7, 567, 27, 28, 22], ["+", 36, 36, 0, 493, 0, 7, 567, 27, 28, 22], ["-", 8, 556, 0, 57, 15, 23, 0, 16, 31, 22], ["...
2
600
8
import static java.util.Arrays.deepToString; import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { new Main().run(); } void tr(Object... os) { System.err.println(deepToString(os)); } Scanner sc = new Scanner(System.in); public void run() { int t =...
import static java.util.Arrays.deepToString; import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { new Main().run(); } void tr(Object... os) { System.err.println(deepToString(os)); } Scanner sc = new Scanner(System.in); public void run() { int t ...
[["-", 0, 7, 8, 1, 0, 492, 3, 4, 0, 252], ["+", 0, 7, 8, 1, 0, 492, 3, 4, 0, 252]]
3
483
2
import java.util.Scanner; public class Main { char[][] makeSpiral(int n) { char[][] pattern = new char[n][n]; int dir = 0; int x = 0, y = n - n % 2; int[] dx = {0, 1, 0, -1}; int[] dy = {-1, 0, 1, 0}; for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { pattern[i][j] = '...
import java.util.Scanner; public class Main { char[][] makeSpiral(int n) { char[][] pattern = new char[n][n]; int dir = 0; int x = 0, y = n - n % 2; int[] dx = {0, 1, 0, -1}; int[] dy = {-1, 0, 1, 0}; for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { pattern[i][j] = '...
[["-", 0, 16, 12, 23, 0, 16, 12, 16, 12, 252], ["+", 0, 16, 12, 23, 0, 16, 12, 16, 12, 252], ["-", 0, 52, 8, 196, 0, 1, 0, 11, 12, 252], ["+", 0, 52, 8, 196, 0, 1, 0, 11, 12, 252]]
3
582
10
#include <stdio.h> int main() { int i, j, k, n, m, x, y; char b[101][101]; scanf("%d", &n); while (n--) { for (i = 0; i < 100; i++) { for (j = 0; j < 100; j++) { b[i][j] = ' '; } } scanf("%d", &m); x = m; y = 1; b[x][y] = '#'; for (i = 0, k = m - 1; i < m; i++)...
#include <stdio.h> int main() { int i, j, k, n, m, x, y; char b[101][101]; scanf("%d", &n); while (n--) { for (i = 0; i < 101; i++) { for (j = 0; j < 101; j++) { b[i][j] = ' '; } } scanf("%d", &m); x = m; y = 1; b[x][y] = '#'; for (i = 0, k = m - 1; i < m; i++)...
[["-", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 23, 0, 91, 17, 111]]
0
346
5
#include <stdio.h> #include <stdlib.h> enum { UP, DOWN, LEFT, RIGHT }; int main(void) { char puttern[100][101]; int x, y; int direction; int nomove; int putternsize; int datamax, datanum; scanf("%d", &datamax); for (datanum = 0; datanum < datamax; datanum++) { if (datanum > 0) puts(""); ...
#include <stdio.h> #include <stdlib.h> enum { UP, DOWN, LEFT, RIGHT }; int main(void) { char puttern[100][101]; int x, y; int direction; int nomove; int putternsize; int datamax, datanum; scanf("%d", &datamax); for (datanum = 0; datanum < datamax; datanum++) { if (datanum > 0) puts(""); ...
[["-", 31, 16, 31, 16, 31, 16, 31, 16, 17, 60], ["+", 31, 16, 31, 16, 31, 16, 31, 16, 17, 19], ["+", 31, 16, 31, 16, 31, 16, 31, 16, 17, 20], ["-", 75, 76, 0, 9, 0, 1, 0, 27, 28, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 27, 28, 22]]
0
737
10
#include <algorithm> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define reep(i, a, b) for (int i = (a); i ...
#include <algorithm> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define reep(i, a, b) for (int i = (a); i ...
[["-", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["-", 8, 9, 0, 14, 8, 9, 0, 1, 0, 35]]
1
731
4
#include <cstring> #include <iostream> #include <string> #include <vector> #define REP(i, k, n) for (int i = k; i < n; i++) #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; int main() { int n; cin >> n; int a[101][101]; int dx[4] = {0, 1, 0, -1}; int dy[4] = {-1, 0, 1, 0}; bool first ...
#include <cstring> #include <iostream> #include <string> #include <vector> #define REP(i, k, n) for (int i = k; i < n; i++) #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; int main() { int n; cin >> n; int a[101][101]; int dx[4] = {0, 1, 0, -1}; int dy[4] = {-1, 0, 1, 0}; bool first ...
[["-", 31, 16, 31, 16, 31, 16, 12, 5, 0, 6], ["+", 31, 16, 31, 16, 31, 16, 12, 5, 0, 6]]
1
527
2
// Name: Spiral Pattern // Level: 2 // Category: シミュレーション // Note: /** * n×nの領域を用意して、左下隅から渦巻きをたどるようにして埋めていく。 * 現在の進行方向について、壁にぶつかるときか、もう1歩進むと他の線に干渉するというときには右に曲がる。 */ #include <iostream> #include <string> #include <vector> using namespace std; // ostream support for vector. template <typename T> ostream &operator<<...
// Name: Spiral Pattern // Level: 2 // Category: シミュレーション // Note: /** * n×nの領域を用意して、左下隅から渦巻きをたどるようにして埋めていく。 * 現在の進行方向について、壁にぶつかるときか、もう1歩進むと他の線に干渉するというときには右に曲がる。 */ #include <iostream> #include <string> #include <vector> using namespace std; // ostream support for vector. template <typename T> ostream &operator<<...
[["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]]
1
615
2
#include <bits/stdc++.h> #define range(i, a, b) for (int i = (a); i < (b); i++) #define rep(i, b) range(i, 0, b) #define pb(a) push_back(a) #define all(a) (a).begin(), (a).end() #define debug(x) cout << "debug " << x << endl; #define INF (1 << 30) using namespace std; void solve(char a[105][105], int inp, int d, int y...
#include <bits/stdc++.h> #define range(i, a, b) for (int i = (a); i < (b); i++) #define rep(i, b) range(i, 0, b) #define pb(a) push_back(a) #define all(a) (a).begin(), (a).end() #define debug(x) cout << "debug " << x << endl; #define INF (1 << 30) using namespace std; void solve(char a[105][105], int inp, int d, int y...
[["-", 31, 16, 31, 16, 31, 16, 12, 5, 0, 6], ["+", 31, 16, 31, 16, 31, 16, 12, 5, 0, 6]]
1
406
2
#include "bits/stdc++.h" using namespace std; const int dx[4] = {-1, 0, 1, 0}; const int dy[4] = {0, 1, 0, -1}; int main() { int D; cin >> D; while (D--) { int N; cin >> N; vector<vector<char>> field(N, vector<char>(N, ' ')); int way = 3; int nx = 0; int ny = N - 1; bool flag = true; ...
#include "bits/stdc++.h" using namespace std; const int dx[4] = {-1, 0, 1, 0}; const int dy[4] = {0, 1, 0, -1}; int main() { int D; cin >> D; while (D--) { int N; cin >> N; vector<vector<char>> field(N, vector<char>(N, ' ')); int way = 3; int nx = 0; int ny = N - 1; bool flag = true; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 33], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 52, 8, 9, 0, 57, 15, 339, 51, 22]]
1
390
4
#include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long ll; typedef...
#include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long ll; typedef...
[["-", 8, 9, 0, 1, 0, 11, 12, 103, 0, 125], ["+", 8, 9, 0, 1, 0, 11, 12, 103, 0, 125]]
1
896
2
#include <iostream> using namespace std; bool vis[30][30], na[30][30]; int dx[] = {0, 1, 0, -1}, dy[] = {-1, 0, 1, 0}; int ex[] = {-1, 1, 0, 0}, ey[] = {0, 0, -1, 1}; int n; void DFS(int y, int x, int k) { vis[y][x] = true; na[y][x] = true; int xx, yy; bool done = false; for (int i = 0; i < 4; i++) { xx =...
#include <iostream> using namespace std; bool vis[110][110], na[110][110]; int dx[] = {0, 1, 0, -1}, dy[] = {-1, 0, 1, 0}; int ex[] = {-1, 1, 0, 0}, ey[] = {0, 0, -1, 1}; int n; void DFS(int y, int x, int k) { vis[y][x] = true; na[y][x] = true; int xx, yy; bool done = false; for (int i = 0; i < 4; i++) { ...
[["-", 0, 30, 0, 43, 49, 80, 49, 80, 81, 13], ["+", 0, 30, 0, 43, 49, 80, 49, 80, 81, 13], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13]]
1
482
8
#include <algorithm> #include <cassert> #include <cctype> #include <complex> #include <cstdio> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; int n, dy[] = {-1, 0, 1, 0}, dx[] = {0, 1, 0, -1}; char c[100][10...
#include <algorithm> #include <cassert> #include <cctype> #include <complex> #include <cstdio> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; int n, dy[] = {-1, 0, 1, 0}, dx[] = {0, 1, 0, -1}; char c[100][10...
[["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35]]
1
388
4
// 01 #include <algorithm> #include <iostream> using namespace std; int n; char g[100][100]; bool fr(int y, int x, int py, int px) { bool f = true; for (int i = 0; i < 4; i++) { int d[] = {0, 1, 0, -1, 0}; int jy = y + d[i]; int jx = x + d[i + 1]; f &= min(jx, jy) < 0 || n <= max(jx, jy) || (px =...
// 01 #include <algorithm> #include <iostream> using namespace std; int n; char g[100][100]; bool fr(int y, int x, int py, int px) { bool f = true; for (int i = 0; i < 4; i++) { int d[] = {0, 1, 0, -1, 0}; int jy = y + d[i]; int jx = x + d[i + 1]; f &= min(jx, jy) < 0 || n <= max(jx, jy) || (px =...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["-", 8, 9, 0, 52, 15, 339, 51, 27, 28, 22], ["+", 8, 9, 0, 52, 15, 339, 51, 27, 28, 22], ["-", 0, 52, 8, 9, 0, 57, 15, 339, 51, 22], ["+", 0, 52, 8, 9, ...
1
435
8
#include <iostream> using namespace std; #define N 100 #define rep(i, n) for (int i = 0; i < n; ++i) int dx[] = {-1, 0, 1, 0}; int dy[] = {0, -1, 0, 1}; bool inRange(int x, int a, int b) { return a <= x && x <= b; } void drawSpiral(int n) { char mat[N][N]; rep(i, n) rep(j, n) mat[i][j] = ' '; int x = 0, y = n...
#include <iostream> using namespace std; #define N 100 #define rep(i, n) for (int i = 0; i < n; ++i) int dx[] = {-1, 0, 1, 0}; int dy[] = {0, -1, 0, 1}; bool inRange(int x, int a, int b) { return a <= x && x <= b; } void drawSpiral(int n) { char mat[N][N]; rep(i, n) rep(j, n) mat[i][j] = ' '; int x = 0, y = n...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
321
4
puts ("1\n"..gets).map{n=gets.to_i n<2?"#\n":n<3?"# \n"*2:(a=[?#*n+?\n]+(2..n).map{?#+" "*(n-2)+"#\n"} c=i=j=n-1 d=[[1,0],[0,-1],[-1,0],[0,1]] (c=0;(x,y),_=d.rotate!;(c+=1;a[i+=x][j+=y]=?#)while a[i+x*2][j+y*2]<?#)while c>1 a*"")}*?\n
puts ("1\n"..gets).map{n=gets.to_i n<2?"#\n":n<3?"##\n# \n":(a=[?#*n+?\n]+(2..n).map{?#+" "*(n-2)+"#\n"} c=i=j=n-1 d=[[1,0],[0,-1],[-1,0],[0,1]] (c=0;(x,y),_=d.rotate!;(c+=1;a[i+=x][j+=y]=?#)while a[i+x*2][j+y*2]<?#)while c>1 a*"")}*?\n
[["+", 8, 734, 0, 754, 75, 754, 64, 557, 0, 6], ["+", 8, 734, 0, 754, 75, 754, 64, 557, 0, 44], ["-", 8, 734, 0, 754, 75, 754, 64, 738, 17, 48], ["-", 8, 734, 0, 754, 75, 754, 64, 738, 12, 612]]
4
178
4
def f(n): spiral = [list(' ' for i in range(n)) for i in range(n)] for i in range(n): spiral[i][0] = '#' for i in range(n): spiral[0][i] = '#' for i in range(n): spiral[i][-1] = '#' return spiral def draw(n, m): #down for w in range(m, n): sp...
def f(n): spiral = [list(' ' for i in range(n)) for i in range(n)] for i in range(n): spiral[i][0] = '#' for i in range(n): spiral[0][i] = '#' for i in range(n): spiral[i][-1] = '#' return spiral def draw(n, m): #down for w in range(m, n): sp...
[["-", 0, 662, 12, 634, 0, 634, 0, 557, 0, 6], ["+", 0, 662, 12, 634, 0, 634, 0, 557, 0, 6]]
5
342
4
#include <stdio.h> #include <string.h> int N, c[10005], p[10005], i, j, t; int main() { for (; scanf("%d", &N), N;) { memset(c, 0, sizeof(c)); memset(p, 0, sizeof(p)); for (i = 1; i < N; i++) p[i * i % N] = 1; for (i = 1; i <= 10000; i++) for (j = 1; j <= 10000; j++) if (i != j && ...
#include <stdio.h> #include <string.h> int N, c[10005], p[10005], i, j, t; int main() { for (; scanf("%d", &N), N;) { memset(c, 0, sizeof(c)); memset(p, 0, sizeof(p)); for (i = 1; i < N; i++) p[i * i % N] = 1; for (i = 0; i <= 10000; i++) for (j = 0; j <= 10000; j++) if (i != j && ...
[["-", 0, 7, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 7, 8, 9, 0, 7, 10, 11, 12, 13], ["-", 8, 9, 0, 7, 8, 7, 10, 11, 12, 13], ["+", 8, 9, 0, 7, 8, 7, 10, 11, 12, 13]]
0
214
4
#include <bits/stdc++.h> #define R(i, n) for (int i = 0; i < n; i++) using namespace std; int main() { int n; cin >> n; while (n--) { int i, k = 1500, m2 = 10000, m1 = 0; char a[3000]; string s; cin >> s; a[k] = s[0]; for (i = 1; i < s.size(); i += 3) { if (s[i] == '-') k--; ...
#include <bits/stdc++.h> #define R(i, n) for (int i = 0; i < n; i++) using namespace std; int main() { int n; cin >> n; while (n--) { int i, k = 1500, m2 = 1500, m1 = 1500; char a[3000]; string s; cin >> s; a[k] = s[0]; for (i = 1; i < s.size(); i += 3) { if (s[i] == '-') k--...
[["-", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 7, 10, 11, 12, 16, 17, 72], ["-", 8, 9, 0, 7, 10, 11, 12, 16, 12, 13]]
1
166
6
#include <iostream> #include <string> int main() { int n; std::cin >> n; for (int i = 0; i < n; i++) { char train[60]; for (int j = 0; j < 30; j++) train[j] = '?'; int it = 30; std::string str; std::cin >> str; train[it] = str[0]; for (int j = 1; j < str.size(); j++) { i...
#include <iostream> #include <string> int main() { int n; std::cin >> n; for (int i = 0; i < n; i++) { char train[60]; for (int j = 0; j < 60; j++) train[j] = '?'; int it = 30; std::string str; std::cin >> str; train[it] = str[0]; for (int j = 1; j < str.size(); j++) { i...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13]]
1
242
4
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for (int i = 0; i < n; i++) { boolean[][] map = new boolean[10][10]; for (int j = 0; j < 10; j++) { for (int k = 0; k < 10; k++)...
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for (int i = 0; i < n; i++) { boolean[][] map = new boolean[10][10]; for (int j = 0; j < 10; j++) { for (int k = 0; k < 10; k++)...
[["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 60], ["-", 8, 196, 0, 57, 15, 15, 0, 16, 12, 499], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 79], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 12, 499]]
3
740
4
import java.io.*; public class Main { public static void main(String args[]) { try { new Main(); } catch (IOException e) { e.printStackTrace(); } } public int[][] offset = new int[][] {{-1, 0}, {1, 0}, {0, -1}, {0, 1}}; public Main() throws IOException { BufferedReader in = new Bu...
import java.io.*; public class Main { public static void main(String args[]) { try { new Main(); } catch (IOException e) { e.printStackTrace(); } } public int[][] offset = new int[][] {{-1, 0}, {1, 0}, {0, 1}, {0, -1}}; public Main() throws IOException { BufferedReader in = new Bu...
[["-", 51, 227, 51, 518, 0, 518, 0, 91, 17, 33], ["+", 51, 227, 51, 518, 0, 518, 0, 91, 17, 33]]
3
865
2
/* AOJ 0131 Title: @kankichi573 */ #include <stdio.h> #include <string.h> int n; int ph[10][10]; // photon mult. int ph_org[10][10]; int r[10][10]; void inv(int i, int j) { ph[i][j] ^= 1; if (i > 0) ph[i - 1][j] ^= 1; if (i < 9) ph[i + 1][j] ^= 1; if (j > 0) ph[i][j - 1] ^= 1; if (j < 9) ...
/* AOJ 0131 Title: @kankichi573 */ #include <stdio.h> #include <string.h> int n; int ph[10][10]; // photon mult. int ph_org[10][10]; int r[10][10]; void inv(int i, int j) { ph[i][j] ^= 1; if (i > 0) ph[i - 1][j] ^= 1; if (i < 9) ph[i + 1][j] ^= 1; if (j > 0) ph[i][j - 1] ^= 1; if (j < 9) ...
[["-", 0, 1, 0, 2, 3, 4, 0, 69, 71, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 69, 71, 13], ["-", 0, 52, 8, 9, 0, 1, 0, 11, 17, 130], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32]]
0
656
4
// Name: Doctor's Strange Particles // Level: 2 // Category: 全探索 // Note: /** * 一番上の行に対する照射方法を固定すると、それより下の行が全て一意に決まる。 * したがって、一番上の行だけを全探索してシミュレーションすればよい。 * * オーダーは O(2^W HW)。 */ #include <array> #include <iostream> using namespace std; array<int, 1 << 10> eff; bool solve(bool first) { array<int, 10> f; for...
// Name: Doctor's Strange Particles // Level: 2 // Category: 全探索 // Note: /** * 一番上の行に対する照射方法を固定すると、それより下の行が全て一意に決まる。 * したがって、一番上の行だけを全探索してシミュレーションすればよい。 * * オーダーは O(2^W HW)。 */ #include <array> #include <iostream> using namespace std; array<int, 1 << 10> eff; bool solve(bool first) { array<int, 10> f; for...
[["+", 0, 43, 49, 50, 51, 16, 12, 69, 28, 22], ["+", 49, 50, 51, 16, 12, 69, 341, 342, 0, 70], ["+", 49, 50, 51, 16, 12, 69, 341, 342, 0, 73]]
1
433
3
#include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long ll; typedef...
#include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long ll; typedef...
[["-", 0, 11, 31, 69, 341, 342, 0, 27, 17, 29], ["+", 0, 7, 8, 9, 0, 57, 64, 1, 0, 35], ["+", 0, 7, 8, 9, 0, 1, 0, 27, 17, 29], ["+", 0, 7, 8, 9, 0, 1, 0, 27, 28, 22]]
1
719
4
#include <bits/stdc++.h> #define l(i, n) for (int i = 0; i < n; i++) using namespace std; bool m[12][12], c[12][12], d[12][12], q; int main() { int n; cin >> n; l(u, n) { l(i, 10) l(j, 10) cin >> m[i][j]; bool f[10], t[10] = {0}; for (int p = 1; p <= 1024; p++) { l(i, 10) f[i] = t[i]; l(i,...
#include <bits/stdc++.h> #define l(i, n) for (int i = 0; i < n; i++) using namespace std; bool m[12][12], c[12][12], d[12][12], q; int main() { int n; cin >> n; l(u, n) { l(i, 10) l(j, 10) cin >> m[i][j]; bool f[10], t[10] = {0}; for (int p = 1; p <= 1024; p++) { l(i, 10) f[i] = t[i]; l(i,...
[["+", 8, 9, 0, 57, 64, 9, 0, 9, 0, 45], ["+", 8, 9, 0, 57, 64, 9, 0, 9, 0, 46]]
1
369
2
#include <cstring> #include <iostream> using namespace std; int n, s, d[12][12], b[12][12], a[12][12]; int dx[] = {0, 0, 0, 1, -1}; int dy[] = {-1, 1, 0, 0, 0}; void flip(int x, int y) { a[y][x] = 1; for (int i = 0; i < 5; i++) { b[y + dy[i]][x + dx[i]] = 1 - b[y + dy[i]][x + dx[i]]; } } void func() { fo...
#include <cstring> #include <iostream> using namespace std; int n, s, d[12][12], b[12][12], a[12][12]; int dx[] = {0, 0, 0, 1, -1}; int dy[] = {-1, 1, 0, 0, 0}; void flip(int x, int y) { a[y][x] = 1; for (int i = 0; i < 5; i++) { b[y + dy[i]][x + dx[i]] = 1 - b[y + dy[i]][x + dx[i]]; } } void func() { fo...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["-", 0, 2, 3, 4, 0, 105, 51, 23, 0, 22], ["+", 0, 2, 3, 4, 0, 105, 51, 23, 0, 22], ["-", 0, 1, 0, 11, 12, 69, 28, 69, 28, 22], ["+", 0, 1, 0, 11, 12, 69, 28, 69, 28, 22]]
1
444
6
#include <cstdio> using namespace std; int memo[11][1024]; int main() { int sw[1024]; for (int i = 0; i < 1024; i++) { sw[i] = 0; if (i & 1) sw[i] ^= 3; for (int j = 1; j < 9; j++) if (i & (1 << j)) sw[i] ^= (7 << (j - 1)); if (i & 512) sw[i] ^= 768; } int t; scan...
#include <cstdio> using namespace std; int memo[11][1024]; int main() { int sw[1024]; for (int i = 0; i < 1024; i++) { sw[i] = 0; if (i & 1) sw[i] ^= 3; for (int j = 1; j < 9; j++) if (i & (1 << j)) sw[i] ^= (7 << (j - 1)); if (i & 512) sw[i] ^= 768; } int t; scan...
[["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 0, 7, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]]
1
478
8
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <list> #include <string> #include <vector> using namespace std; int f(int p[][12], int q[][12], int x) { int i, j; int r[12][12], s[12][12]; if (x == 11) { for (i = 2; i < 10; i++) { ...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <list> #include <string> #include <vector> using namespace std; int f(int p[][12], int q[][12], int x) { int i, j; int r[12][12], s[12][12]; if (x == 11) { for (i = 2; i < 10; i++) { ...
[["-", 31, 16, 12, 69, 28, 69, 341, 342, 0, 22], ["+", 31, 16, 12, 69, 28, 69, 341, 342, 0, 22], ["-", 0, 16, 31, 16, 12, 69, 341, 342, 0, 22], ["+", 0, 16, 31, 16, 12, 69, 341, 342, 0, 22]]
1
1,644
4
#!/usr/bin/ruby def lightsout(x,y) now=Time.now.to_f succ=0 a=Array.new(x*y) a.length.times{|i| a[i]=Array.new(2)} #create problem x.times {|i| y.times {|j| a[i+j*x][0]=1<<(i+j*x) a[i+j*x][1]= 0 + (1<<(i+j*x)) + (i>0 ? 1<<(i-1+j*x) : 0) + (i<x-1 ? 1<<(i+1+j*x) : 0)...
#!/usr/bin/ruby def lightsout(x,y) now=Time.now.to_f succ=0 a=Array.new(x*y) a.length.times{|i| a[i]=Array.new(2)} #create problem x.times {|i| y.times {|j| a[i+j*x][0]=1<<(i+j*x) a[i+j*x][1]= 0 + (1<<(i+j*x)) + (i>0 ? 1<<(i-1+j*x) : 0) + (i<x-1 ? 1<<(i+1+j*x) : 0)...
[["+", 3, 4, 0, 652, 3, 4, 0, 557, 0, 6]]
4
487
1
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line = ""; char[][] pattern = new char[8][8]; ...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line = ""; char[][] pattern = new char[8][8]; ...
[["-", 3, 4, 0, 230, 3, 4, 0, 504, 71, 22], ["+", 3, 4, 0, 230, 3, 4, 0, 504, 71, 22]]
3
284
2
#include <stdio.h> int main() { char s[8][8]; int i, j, k; for (i = 0; i < 8; i++) { fgets(s[i], 10, stdin); } printf("90\n"); for (i = 0; i < 8; i++) { for (j = 0; j < 8; j++) { printf("%c", s[7 - i][j]); } printf("\n"); } printf("180\n"); for (i = 0; i < 8; i++) { for (j = ...
#include <stdio.h> int main() { char s[8][8]; int i, j, k; for (i = 0; i < 8; i++) { fgets(s[i], 10, stdin); } printf("90\n"); for (i = 0; i < 8; i++) { for (j = 0; j < 8; j++) { printf("%c", s[7 - j][i]); } printf("\n"); } printf("180\n"); for (i = 0; i < 8; i++) { for (j = ...
[["-", 3, 4, 0, 69, 28, 69, 71, 16, 12, 22], ["+", 3, 4, 0, 69, 28, 69, 71, 16, 12, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 69, 71, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 69, 71, 22], ["-", 0, 2, 3, 4, 0, 69, 28, 69, 71, 22], ["+", 0, 2, 3, 4, 0, 69, 28, 69, 71, 22], ["-", 0, 2, 3, 4, 0, 69, 71, 16, 12, 22], ["+", 0, 2, 3, 4, 0, 69, ...
0
242
8
#include <stdio.h> #include <stdlib.h> #include <string.h> int n, i, j, k, x, set, a[50000], b[50000], c[50000]; int main() { while (scanf("%d", &n) * n) { set++; for (i = 1; i < n; i++) if (a[(i * i) % n] != set) a[(i * i) % n] = set; for (i = 1, j = 0; i < n; i++) { if (a[i] == set...
#include <stdio.h> #include <stdlib.h> #include <string.h> int n, i, j, k, x, set, a[50000], b[50000], c[50000]; int main() { while (scanf("%d", &n) * n) { set++; for (i = 1; i < n; i++) if (a[(i * i) % n] != set) a[(i * i) % n] = set; for (i = 0, j = 0; i < n; i++) { if (a[i] == set...
[["-", 8, 9, 0, 7, 10, 34, 31, 11, 12, 13], ["+", 8, 9, 0, 7, 10, 34, 31, 11, 12, 13]]
0
251
2
#include <set> #include <stdio.h> #include <vector> using namespace std; const int N = 1e4 + 10; #define PB push_back int abs(int n) { return n > 0 ? n : -n; } int main() { int n, a[N], mid, temp; set<int> s; vector<int> v; while (scanf("%d", &n) != EOF) { if (n == 0) return 0; s.clear(); v.cl...
#include <set> #include <stdio.h> #include <vector> using namespace std; const int N = 1e4 + 10; #define PB push_back int abs(int n) { return n > 0 ? n : -n; } int main() { int n, a[N], mid, temp; set<int> s; vector<int> v; while (scanf("%d", &n) != EOF) { if (n == 0) return 0; s.clear(); v.cl...
[["-", 8, 1, 0, 2, 3, 4, 0, 16, 17, 48], ["-", 8, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
283
2
#include <algorithm> #include <iostream> using namespace std; const int MAX = 10010; int main(void) { int square[MAX]; for (int i = 1; i < MAX + 1; i++) square[i - 1] = i * i; while (true) { int n, size; int raw_mod[MAX], mod[MAX], hist[MAX] = {}; cin >> n; if (n == 0) break; int ...
#include <algorithm> #include <iostream> using namespace std; const int MAX = 10010; int main(void) { int square[MAX]; for (int i = 1; i < MAX + 1; i++) square[i - 1] = i * i; while (true) { int n, size; int raw_mod[MAX], mod[MAX], hist[MAX] = {}; cin >> n; if (n == 0) break; int ...
[["-", 0, 52, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 12, 22]]
1
359
2
#include <iostream> #include <vector> using namespace std; #define rep2(x, from, to) for (int x = (from); x < (to); ++(x)) #define rep(x, to) rep2(x, 0, to) int main() { int n; while (cin >> n, n) { int a[10000] = {}; int c[5000] = {}; rep2(i, 1, n) { a[(i * i) % n]++; } vector<int> v; rep2(i, 1...
#include <iostream> #include <vector> using namespace std; #define rep2(x, from, to) for (int x = (from); x < (to); ++(x)) #define rep(x, to) rep2(x, 0, to) int main() { int n; while (cin >> n, n) { int a[10000] = {}; int c[5000] = {}; rep2(i, 1, n) { a[(i * i) % n]++; } vector<int> v; rep(i, n)...
[["-", 0, 52, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 52, 8, 9, 0, 14, 49, 53, 49, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]]
1
232
5