結果
| 問題 |
No.634 硬貨の枚数1
|
| コンテスト | |
| ユーザー |
ngtkana
|
| 提出日時 | 2020-04-04 13:08:19 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 602 bytes |
| コンパイル時間 | 2,180 ms |
| コンパイル使用メモリ | 194,400 KB |
| 最終ジャッジ日時 | 2025-01-09 14:01:38 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 75 |
ソースコード
#include<bits/stdc++.h>
using lint=long long;
using real=long double;
int main(){
std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
std::cout.setf(std::ios_base::fixed);std::cout.precision(15);
lint n;std::cin>>n;
std::vector<lint>a;
for(lint i=1,j=1;j<=n;j+=++i)a.push_back(j);
if(a.back()==n){
std::cout<<1<<'\n';
return 0;
}
lint m=a.size();
for(lint i=1,j=m-1;i<m;i++){
for(;n<a.at(i)+a.at(j);j--);
if(n==a.at(i)+a.at(j)){
std::cout<<2<<'\n';
return 0;
}
}
std::cout<<3<<'\n';
}
ngtkana