結果
| 問題 | No.604 誕生日のお小遣い | 
| コンテスト | |
| ユーザー |  dustnn0 | 
| 提出日時 | 2018-03-11 14:41:24 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 1,000 ms | 
| コード長 | 368 bytes | 
| コンパイル時間 | 1,549 ms | 
| コンパイル使用メモリ | 166,912 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-11-21 19:23:34 | 
| 合計ジャッジ時間 | 2,554 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 21 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define rep(i,a) for(int i=0;i<(a);i++)
#define MOD 1000000007
int main(){
  ll A,B,C;cin>>A>>B>>C;
  ll x=C/(A+B-1),ans=x*A;
  ll res=C-(A+B-1)*x;
  if(res>A){
    ans+=A;
    res-=(A+B-1);
  }
  if(res<=0) cout<<ans<<endl;
  else cout<<ans+res<<endl;
  return 0;
}
            
            
            
        