結果
問題 | No.152 貯金箱の消失 |
ユーザー | ry0u_yd |
提出日時 | 2015-09-04 02:25:08 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 1,173 ms / 5,000 ms |
コード長 | 940 bytes |
コンパイル時間 | 852 ms |
コンパイル使用メモリ | 73,868 KB |
実行使用メモリ | 332,216 KB |
最終ジャッジ日時 | 2023-09-26 04:17:34 |
合計ジャッジ時間 | 16,835 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,166 ms
331,516 KB |
testcase_01 | AC | 1,166 ms
331,076 KB |
testcase_02 | AC | 1,173 ms
331,068 KB |
testcase_03 | AC | 1,165 ms
331,380 KB |
testcase_04 | AC | 1,166 ms
332,216 KB |
testcase_05 | AC | 1,165 ms
331,260 KB |
testcase_06 | AC | 1,167 ms
330,864 KB |
testcase_07 | AC | 1,169 ms
331,108 KB |
testcase_08 | AC | 1,164 ms
331,544 KB |
testcase_09 | AC | 1,157 ms
332,048 KB |
testcase_10 | AC | 1,165 ms
330,948 KB |
testcase_11 | AC | 1,163 ms
331,108 KB |
ソースコード
#include <iostream> #include <vector> #include <string> #include <cstring> #include <algorithm> #include <sstream> #include <map> #include <set> #define REP(i,k,n) for(int i=k;i<n;i++) #define rep(i,n) for(int i=0;i<n;i++) #define INF 1<<30 #define pb push_back #define mp make_pair using namespace std; typedef long long ll; typedef pair<int,int> P; int main() { int l; cin >> l; l /= 4; vector< vector<int> > v; REP(i,1,5005) { REP(j,i+1,5005) { if(i == j) continue; if((j-i)%2 == 0) continue; if(__gcd(i,j) != 1) continue; vector<int> t(3); t[0] = j*j - i*i; t[1] = 2*i*j; t[2] = j*j + i*i; v.push_back(t); } } int cnt = 0; rep(i,v.size()) { int sum = 0; rep(j,v[i].size()) sum += v[i][j]; if(sum <= l) cnt++; } cout << cnt << endl; return 0; }