結果
問題 |
No.176 2種類の切手
|
ユーザー |
|
提出日時 | 2016-10-05 01:16:41 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 641 bytes |
コンパイル時間 | 459 ms |
コンパイル使用メモリ | 54,232 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-21 17:01:58 |
合計ジャッジ時間 | 1,291 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 WA * 1 |
ソースコード
#include <iostream> using namespace std; int main(){ long A,B,T,N,result = 10000000000; int A_times,B_times,ab_times=0; //T=A*B*ab_times+N | N < A*B cin >> A>>B>>T; ab_times = T/(A*B); N = T-A*B*ab_times; for(B_times = 0;B*(B_times-1)<N;B_times++){ //calculate once more time A_times = (N-B*B_times)/A; if(A_times < 0)break; //A_times cannot be negative if((A*A_times+B*B_times)<N) A_times++; result = min(result,A*A_times+B*B_times); //cout << A_times<< " "<< B_times<<" "<< result<<endl; } cout << result + A*B*ab_times << endl; }