結果
| 問題 |
No.176 2種類の切手
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-10-05 01:08:04 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 503 bytes |
| コンパイル時間 | 443 ms |
| コンパイル使用メモリ | 55,644 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-21 17:01:57 |
| 合計ジャッジ時間 | 1,320 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 23 WA * 6 |
ソースコード
#include <iostream>
using namespace std;
int main(){
long A,B,T,N,result = 1000000000;
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<N+B;B_times++){
A_times = (N-B*B_times)/A;
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;
}