結果

問題 No.604 誕生日のお小遣い
ユーザー kaito_tateyama
提出日時 2019-03-06 09:11:12
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 481 bytes
コンパイル時間 782 ms
コンパイル使用メモリ 67,968 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-21 19:27:20
合計ジャッジ時間 1,635 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

#define REP(i,n) for(int i = 0; i < (n); ++i)
#define P(x) cout << (x) << "\n"
#define D(x) cerr << (x) << "\n"
#define fcout cout << fixed << setprecision(18)

using i64=long long int; // 10^18

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  
  i64 a,b,c;cin>>a>>b>>c;
  i64 n = c/(a+b-1);
  i64 m = (c-n*(a+b-1)) - (a-1);
  i64 ans = n*a + (m>0 ? a : m + a-1);
  P(ans);

  return 0;
}
0