結果
問題 | No.152 貯金箱の消失 |
ユーザー |
![]() |
提出日時 | 2021-11-02 20:22:25 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 43 ms / 5,000 ms |
コード長 | 565 bytes |
コンパイル時間 | 3,942 ms |
コンパイル使用メモリ | 251,668 KB |
最終ジャッジ日時 | 2025-01-25 10:27:27 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 12 |
ソースコード
#include <stdio.h>#include <bits/stdc++.h>#include <atcoder/all>using namespace atcoder;using mint = modint;using namespace std;#define rep(i,n) for (int i = 0; i < (n); ++i)#define Inf 1000000001int main(){mint::set_mod(1000003);int L;cin>>L;L /= 4;mint ans = 0;for(long long i=1;true;i++){if(i*i>L)break;for(long long j=1;j<i;j++){long long a = i*i+j*j;long long b = i*j*2;long long c = i*i-j*j;if(a+b+c>L)break;if(gcd(gcd(a,b),c)==1){ans++;}}}cout<<ans.val()<<endl;return 0;}