結果
| 問題 |
No.634 硬貨の枚数1
|
| コンテスト | |
| ユーザー |
dnish
|
| 提出日時 | 2018-06-22 12:49:49 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 726 bytes |
| コンパイル時間 | 1,619 ms |
| コンパイル使用メモリ | 174,104 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-30 17:55:41 |
| 合計ジャッジ時間 | 3,556 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 75 |
ソースコード
#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,ans=3;
unordered_map<int,bool> mp;
cin>>N;
for(int k=1;k*(k+1)<=2*N;k++){
mp[k*(k+1)/2]=1;
if(k*(k+1)/2==N) {
p(1);
return 0;
}
}
for(auto m:mp) {
if(mp.find(N-m.first)!=mp.end()){
p(2);
return 0;
}
}
p(3);
return 0;
}
dnish