結果
| 問題 | No.152 貯金箱の消失 |
| コンテスト | |
| ユーザー |
albicilla
|
| 提出日時 | 2015-06-05 21:29:32 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 684 bytes |
| コンパイル時間 | 674 ms |
| コンパイル使用メモリ | 79,248 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-06 14:19:40 |
| 合計ジャッジ時間 | 1,402 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 WA * 2 |
ソースコード
#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;
}
albicilla