結果

問題 No.152 貯金箱の消失
ユーザー ry0u_ydry0u_yd
提出日時 2015-09-04 02:22:51
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 940 bytes
コンパイル時間 2,092 ms
コンパイル使用メモリ 72,980 KB
実行使用メモリ 15,336 KB
最終ジャッジ日時 2023-09-26 04:17:16
合計ジャッジ時間 2,621 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
14,472 KB
testcase_01 AC 45 ms
15,336 KB
testcase_02 AC 46 ms
14,980 KB
testcase_03 AC 46 ms
14,732 KB
testcase_04 AC 46 ms
14,748 KB
testcase_05 AC 44 ms
14,500 KB
testcase_06 AC 46 ms
15,180 KB
testcase_07 AC 45 ms
14,524 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 47 ms
14,912 KB
testcase_11 AC 45 ms
15,044 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main() {
    int l;
    cin >> l;

    l /= 4;

    vector< vector<int> > v;

    REP(i,1,1005) {
        REP(j,i+1,1005) {
            if(i == j) continue;
            if((j-i)%2 == 0) continue;
            if(__gcd(i,j) != 1) continue;

            vector<int> t(3);
            t[0] = j*j - i*i;
            t[1] = 2*i*j;
            t[2] = j*j + i*i;

            v.push_back(t);
        }
    }

    int cnt = 0;
    rep(i,v.size()) {
        int sum = 0;
        rep(j,v[i].size()) sum += v[i][j];

        if(sum <= l) cnt++;
    }

    cout << cnt << endl;

    return 0;
}
0