結果
問題 | No.825 賢いお買い物 |
ユーザー |
|
提出日時 | 2019-05-04 00:02:29 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 396 bytes |
コンパイル時間 | 782 ms |
コンパイル使用メモリ | 68,100 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-31 20:32:52 |
合計ジャッジ時間 | 1,681 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 |
コンパイルメッセージ
main.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 5 | main() | ^~~~
ソースコード
#include<iostream> #include<algorithm> using namespace std; int a,b,c; main() { cin>>a>>b>>c; int ans=1e9; for(int i=0;i<=a;i++) { for(int j=0;j<=b;j++) { if(i+j==0)continue; int now=i+j*10; int rest=a-i+b-j; for(int k=0;k<now;k++) { int come=rest+k/10+k%10; if(come==c)ans=min(ans,now-k); } } } if(ans<1e9)cout<<ans<<endl; else cout<<"Impossible"<<endl; }