結果
| 問題 |
No.152 貯金箱の消失
|
| コンテスト | |
| ユーザー |
mayoko_
|
| 提出日時 | 2015-02-15 23:27:11 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 168 ms / 5,000 ms |
| コード長 | 759 bytes |
| コンパイル時間 | 642 ms |
| コンパイル使用メモリ | 73,368 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-23 20:24:14 |
| 合計ジャッジ時間 | 1,719 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 12 |
ソースコード
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;
typedef long long ll;
const ll MOD = 1000003;
int main(void) {
ll L;
cin >> L;
int ans = 0;
int limit = 0;
for (limit = 0; limit*limit <= L; limit++) {}
for (int n = 1; n < limit; n++) {
for (int m = n+1; m < limit; m += 2) {
if (__gcd(m, n) != 1) continue;
ll a = m*m - n*n;
ll b = 2*m*n;
ll c = m*m+n*n;
if (L >= (a+b+c) * 4) ans++;
}
}
cout << ans << endl;
return 0;
}
mayoko_