結果
問題 | No.634 硬貨の枚数1 |
ユーザー |
![]() |
提出日時 | 2021-08-09 16:09:18 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 27 ms / 2,000 ms |
コード長 | 423 bytes |
コンパイル時間 | 3,468 ms |
コンパイル使用メモリ | 266,752 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-21 15:08:51 |
合計ジャッジ時間 | 6,491 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 75 |
ソースコード
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; int main(){ int N; cin>>N; int ans=3; for(int i=0;i*(i+1)/2<=N;i++){ if(i*(i+1)/2==N){ ans=min(ans,1); } } for(int i=0;i*(i+1)/2<=N;i++){ for(int j=0;j*(j+1)/2<=N;j++){ if(i*(i+1)/2+j*(j+1)/2==N){ ans=min(ans,2); } } } cout<<ans<<endl; }