結果
問題 | No.2190 平方数の下12桁 |
ユーザー |
|
提出日時 | 2023-03-16 01:13:21 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 157 ms / 2,000 ms |
コード長 | 793 bytes |
コンパイル時間 | 807 ms |
コンパイル使用メモリ | 97,344 KB |
最終ジャッジ日時 | 2025-02-11 11:49:38 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 41 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:32:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 32 | scanf("%lld", &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() {LL n, i, g;LL v, vv, nv, b=1000000;b*=b;scanf("%lld", &v);for (i=0; i<1000000; i++) {nv=(v-i*i+b)%b;// (i*2*x*1000000+i*i)%1000000000000 = v;g = 2000000*gcd(i, 500000);if ((nv%g)==0) break;}if (i<1000000) printf("YES\n"); else printf("NO\n");return 0;}