結果
問題 |
No.648 お や す み
|
ユーザー |
|
提出日時 | 2020-08-19 17:22:39 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 924 bytes |
コンパイル時間 | 1,157 ms |
コンパイル使用メモリ | 110,160 KB |
最終ジャッジ日時 | 2025-01-13 03:52:16 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 82 WA * 2 |
ソースコード
//#pragma GCC optimize ("O3") //#pragma GCC target ("avx") #include <stdio.h> #include <iostream> #include <vector> #include <algorithm> #include <map> #include <queue> #include <cstdio> #include <ctime> #include <assert.h> #include <chrono> #include <random> #include <numeric> #include <set> #include <deque> #include <stack> #include <bitset> using namespace std; typedef long long int ll; typedef unsigned long long ull; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); ll myRand(ll B) { return (ull)rng() % B; } int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); ll nn; cin >> nn; double n=nn; ll m=(sqrt(8*n+1)-1)/2; for(ll i=-5;i<=5;i++){ ll p=m+i; if(p%2==0){ if(p/2*(p+1)==nn){ printf("YES\n"); printf("%lld\n",p); return 0; } } else{ if((p+1)/2*p==nn){ printf("YES\n"); printf("%lld\n",p); return 0; } } } printf("NO\n"); }