結果
問題 |
No.176 2種類の切手
|
ユーザー |
![]() |
提出日時 | 2015-04-02 23:42:11 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 484 bytes |
コンパイル時間 | 784 ms |
コンパイル使用メモリ | 70,936 KB |
実行使用メモリ | 335,296 KB |
最終ジャッジ日時 | 2024-10-08 01:36:00 |
合計ジャッジ時間 | 5,009 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 3 |
other | TLE * 1 -- * 28 |
ソースコード
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <map> #define REP(i,k,n) for(int i=k;i<n;i++) #define rep(i,n) for(int i=0;i<n;i++) #define INF 1<<30 using namespace std; int a,b,t,ans = INF; map<int,bool> memo; void dfs(int x) { if(memo[x]) return; if(x > ans) return; if(x >= t) { ans = min(ans,x); return; } memo[x] = true; dfs(x+a); dfs(x+b); } int main() { cin >> a >> b >> t; dfs(0); cout << ans << endl; return 0; }