結果
問題 |
No.634 硬貨の枚数1
|
ユーザー |
![]() |
提出日時 | 2018-06-22 12:55:41 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 701 bytes |
コンパイル時間 | 1,974 ms |
コンパイル使用メモリ | 198,416 KB |
最終ジャッジ日時 | 2025-01-05 14:53:37 |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 15 WA * 60 |
ソースコード
#include "bits/stdc++.h" #define REP(i,n,N) for(ll i=(n); i<(N); i++) #define RREP(i,n,N) for(ll i=(N-1); i>=n; i--) #define CK(n,a,b) ((a)<=(n)&&(n)<(b)) #define ALL(v) (v).begin(),(v).end() #define p(s) cout<<(s)<<endl #define p2(a,b) cout<<(a)<<" "<<(b)<<endl #define v2(T) vector<vector<T>> typedef long long ll; using namespace std; const ll mod = 1e9+7; int main() { int N; cin>>N; unordered_map<int,bool> mp; for(int k=1;k*(k+1)<=2*N;k++){ if(k*(k+1)/2==N) { p(1); return 0; } mp[k*(k+1)/2]=1; } for(auto m:mp) { if(mp[N-m.first]){ p(2); return 0; } } p(3); return 0; }