結果
問題 | No.152 貯金箱の消失 |
ユーザー |
![]() |
提出日時 | 2015-06-05 21:31:59 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 65 ms / 5,000 ms |
コード長 | 685 bytes |
コンパイル時間 | 588 ms |
コンパイル使用メモリ | 80,596 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-06 14:19:43 |
合計ジャッジ時間 | 1,192 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 12 |
ソースコード
#include <iostream> #include <sstream> #include <string> #include <cmath> #include <cstdio> #include <vector> #include <map> #include <set> #include <queue> #include <deque> #include <algorithm> #include <functional> #include <numeric> typedef long long int ll; using namespace std; long long gcd(long long a, long long b) { if (b == 0) return a; return gcd(b, a%b); }; int main(){ ll L; cin>>L; L /= 4; ll a=0,b=0,c=0,i,j; ll ans=0; for(i=1;i*i<L;i++){ for(j=1;j<i;j++){ if(i%2==j%2) continue; if(gcd(i,j)>1) continue; a=i*i-j*j; b=2*i*j; c=i*i+j*j; if(a+b+c<=L){ ans++; } } } cout<<ans%1000003<<endl; return 0; }