結果

問題 No.152 貯金箱の消失
ユーザー albicillaalbicilla
提出日時 2015-06-05 21:26:20
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 750 bytes
コンパイル時間 526 ms
コンパイル使用メモリ 74,400 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-20 19:22:40
合計ジャッジ時間 2,133 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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>

using namespace std;

typedef long long ll;

long long gcd(long long a, long long b) {
    if (b == 0)
        return a;
    return gcd(b, a%b);    
};

int main(){
    int L;
    cin>>L;
    int a,b,c;
    int ans=0;
    
    for(int i=1;i*i<L;i++){
        for(int j=1;j<i;j++){
            if(i%2==j%2&&gcd(i,j)>1) continue;
                a=i*i-j*j;
                b=2*i*j;
                c=i*i+j*j;
                if(j*j+i*i<L)ans++;
            }
        }
    
    cout<<ans<<endl;
    
    return 0;
}
0