結果

問題 No.152 貯金箱の消失
ユーザー imgry22imgry22
提出日時 2015-02-20 23:18:08
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 67 ms / 5,000 ms
コード長 1,446 bytes
コンパイル時間 1,399 ms
コンパイル使用メモリ 144,544 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-06 02:35:10
合計ジャッジ時間 2,292 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 3 ms
4,380 KB
testcase_07 AC 11 ms
4,380 KB
testcase_08 AC 66 ms
4,376 KB
testcase_09 AC 67 ms
4,376 KB
testcase_10 AC 52 ms
4,380 KB
testcase_11 AC 29 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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_back
template<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;
}
0