結果
問題 | No.152 貯金箱の消失 |
ユーザー |
![]() |
提出日時 | 2015-02-20 23:18:08 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 67 ms / 5,000 ms |
コード長 | 1,446 bytes |
コンパイル時間 | 1,353 ms |
コンパイル使用メモリ | 160,004 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-23 21:28:27 |
合計ジャッジ時間 | 2,232 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 12 |
ソースコード
#include<bits/stdc++.h>using namespace std;typedef long long int ll;typedef pair<int, int> pii;typedef vector<int> vi;typedef vector<pair<int, int> > vii;#define rrep(i, m, n) for(int (i)=(m); (i)<(n); (i)++)#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)#define rrev(i, m, n) for(int (i)=(n)-1; (i)>=(m); (i)--)#define erev(i, m, n) for(int (i)=(n); (i)>=(m); (i)--)#define rev(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)#define vrep(i, c) for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)#define ALL(v) (v).begin(), (v).end()#define mp make_pair#define pb push_backtemplate<class T, class S> inline bool minup(T& m, S x){ return m>(T)x ? (m=(T)x, true) : false; }template<class T, class S> inline bool maxup(T& m, S x){ return m<(T)x ? (m=(T)x, true) : false; }const int INF = 1000000000;const ll MOD = 1000003LL;const double EPS = 1E-12;template<class T> T gcd(T a, T b){T tmp;while(b){tmp = a;a = b;b = tmp%b;}return a;}template<class T> inline T lcm(T a, T b){ return a * (b / gcd(a, b)); }ll L;ll res;int main(){cin >> L;for(ll i=1LL; i*i<=L/4; i++){for(ll j=1LL; j<i; j++){if((i - j) % 2LL == 0LL) continue;if(gcd(i, j) != 1LL) continue;if(4*(2*i*i+2*i*j) <= L) res = (res + 1) % MOD;}}cout << res << endl;return 0;}