結果

問題 No.176 2種類の切手
ユーザー Hank
提出日時 2016-10-05 01:05:37
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 439 bytes
コンパイル時間 638 ms
コンパイル使用メモリ 53,980 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-21 17:01:55
合計ジャッジ時間 1,482 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#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_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 << result + A*B*ab_times << endl;

}
0