結果
| 問題 |
No.2185 平方数の下6桁
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-03-15 21:44:10 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 763 bytes |
| コンパイル時間 | 803 ms |
| コンパイル使用メモリ | 96,352 KB |
| 最終ジャッジ日時 | 2025-02-11 11:42:40 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 37 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:31:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
31 | scanf("%d", &v);
| ~~~~~^~~~~~~~~~
ソースコード
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include <map>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <algorithm>
#include <array>
#include <unordered_set>
#include <unordered_map>
#include <string>
#include <math.h>
using namespace std;
bool rcmp(int a, int b) { return a>b; }
typedef long long LL;
int gcd(int a, int b) {
int t;
while(a) { t=a; a=b%a; b=t; }
return b;
}
int main() {
int n, i, g;
int v, vv, nv;
scanf("%d", &v);
for (i=0; i<1000; i++) {
nv=(v-i*i+1000000)%1000000;
// (i*2*x*1000+i*i)%1000000 = v;
g = 2000*gcd(i, 500);
if ((nv%g)==0) break;
}
if (i<1000) printf("YES\n"); else printf("NO\n");
return 0;
}