2010-09-01から1ヶ月間の記事一覧
DIV2においては500点問題が無茶苦茶落ちる回で、うっかりDIV2の1位の人と同じ部屋になったりと個人的にも踏んだり蹴ったりだったが、DIV1においてはtargetのPetrが全問System Test Failedしたり酷い事になっていて話題だったらしい。自分のレートは一応ちょ…
nkf -s src.txt dst.txt srcとdstは同じファイル名でもOK
404 Not Found #include <cstdio> int main() { int n; while(~scanf("%d\n", &n)) printf("%d\n", (n * n + n + 2) / 2); return 0; } just implemented a formula that I found on the internet</cstdio>
404 Not Found #include <cstdio> int main() { int l, m, n; while(~scanf("%d %d %d", &l, &m, &n), ~l && ~m && ~n){ long long total = l * 60LL * 60 + m * 60 + n, remaining = 120 * 60 - total; printf("%02lld:%02lld:%02lld\n", remaining / 60 / 60, rema</cstdio>…
404 Not Found #include <cstdio> #include <vector> #include <queue> using namespace std; typedef struct {int x, y;} p; char m[8][9]; inline bool valid(int n){return 0 <= n && n < 8;} inline void addqueue(queue<p>& q, int x, int y){ if(valid(x) && valid(y)) if(m[y][x</p></queue></vector></cstdio>…
404 Not Found #include <cstdio> #include <vector> #include <algorithm> using namespace std; int main() { int n, m; while(scanf("%d %d\n", &n, &m), n && m){ vector<int> v; for(int i = 1; i <= n; i++) v.push_back(i); vector<int>::iterator it = v.begin(); while(1 < v.size()){ fo</int></int></algorithm></vector></cstdio>…
404 Not Found #include <cstdio> #include <vector> #include <algorithm> using namespace std; int main() { int n, m; while(scanf("%d %d\n", &n, &m), n && m){ vector<int> v; for(int i = 1; i <= n; i++) v.push_back(i); vector<int>::iterator it = v.begin(); while(1 < v.size()){ fo</int></int></algorithm></vector></cstdio>…
404 Not Found #include <cstdio> int main() { int n; char prime[50001]; for(int i = 0; i <= 50000; i++) prime[i] = 1; prime[0] = 0; prime[1] = 0; for(int i = 2; i <= 50000; i++){ if(!prime[i]) continue; for(int j = i + i; j <= 50000; j += i) prime[</cstdio>…
404 Not Found #include <cstdio> inline int isprime(int n){ for(int i = 2; i <= n / 2; i++){ if(!(n % i)) return 0; } return 1; } int main() { int n; while(~scanf("%d\n", &n)){ for(int i = n - 1; 0 <= i; i--){ if(isprime(i)){ printf("%d ", i); brea</cstdio>…
404 Not Found #include <iostream> #include <string> #include <algorithm> using namespace std; int main() { string s, t; int cnt = 0; while(cin>>s){ t = s; reverse(t.begin(), t.end()); cnt += s == t; } cout<</algorithm></string></iostream>
404 Not Found #include <iostream> #include <string> using namespace std; class Dice { public: int top, bottom, west, east, south, north; Dice(){ top = 1;bottom = 6; west = 4;east = 3; south = 2;north = 5; } void North(){ int tmp = top; top = south; south = </string></iostream>…
404 Not Found #include <cstdio> int main() { int d; while(~scanf("%d\n", &d)){ long long total = 0; for(int i = d; i < 600; i += d) total += (long long)i * i * d; printf("%lld\n", total); } return 0; }</cstdio>
404 Not Found #include <cstdio> int main() { int n; scanf("%d\n", &n); long long m = n; while(--n) m *= n; printf("%lld\n", m); return 0; }</cstdio>
人材獲得作戦・4 試験問題ほか: 人生を書き換える者すらいた。 #include <cstdio> #include <vector> #include <queue> using namespace std; typedef struct { int x, y; } px; int main(){ vector<vector<char> > v; vector<char> li; px st, gl = {-1, -1}; int ylen, xlen; const char wall = '*',</char></vector<char></queue></vector></cstdio>…
404 Not Found #include <cstdio> #include <vector> using namespace std; int main() { long long n; while(scanf("%Ld\n", &n), n){ vector<pair<long long, long long> > v; for(long long i = 0; i < n; i++){ long long p, q, r, f = 1; scanf("%Ld %Ld %Ld\n", &p, &q, &r); for(long long j = 0;</pair<long></vector></cstdio>…
404 Not Found #include <cstdio> int main() { int n; while(scanf("%d\n", &n), n){ int scr_a = 0, scr_b = 0; for(int i = 0; i < n; i++){ int cur_scr_a, cur_scr_b; scanf("%d %d\n", &cur_scr_a, &cur_scr_b); if(cur_scr_a == cur_scr_b){ scr_a += cur_scr</cstdio>…
また0点…どんどん緑コーダーが遠ざかっていく… しかし、さっき手元でデバッグしていたら、本当の恐怖はそんなモンではなかった… 250点問題(誤答) #include <cstdio> #include <cstdlib> #include <cmath> #include <climits> #include <cfloat> #include <map> #include <utility> #include <set> #include <iostream> #include <memory> #in</memory></iostream></set></utility></map></cfloat></climits></cmath></cstdlib></cstdio>…
1012 -- Joseph #include <cstdio> int main() { int k , _n; int r[14]; for(int i = 0; i < 14; i++) r[i] = 0; while(scanf("%d", &k), k){ if(!r[k]){ _n = k * 2; for(int i = k; ; i++){ int n = _n, p = 0; while(n != k){ p = (p + i) % n--; if(p < k) goto</cstdio>…
#include <cstdio> int main() { int n; scanf("%d\n", &n); if(!n) return 0; char *c = new char[n + 1]; for(int i = 0; i <= n; i++) c[i] = 1; c[0] = c[1] = 0; for(int i = 2; i <= n; i++){ if(!c[i]) continue; for(int j = i + i; j <= n; j += i) c[j] = </cstdio>…