結果

問題 No.604 誕生日のお小遣い
ユーザー sheruve
提出日時 2017-12-16 01:59:40
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 346 bytes
コンパイル時間 556 ms
コンパイル使用メモリ 53,548 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-14 16:48:52
合計ジャッジ時間 1,198 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 6 WA * 15
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:13: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘long long int*’ [-Wformat=]
    7 |     scanf("%d%d%d",&A,&B,&C);
      |            ~^      ~~
      |             |      |
      |             int*   long long int*
      |            %lld
main.cpp:7:15: warning: format ‘%d’ expects argument of type ‘int*’, but argument 3 has type ‘long long int*’ [-Wformat=]
    7 |     scanf("%d%d%d",&A,&B,&C);
      |              ~^       ~~
      |               |       |
      |               int*    long long int*
      |              %lld
main.cpp:7:17: warning: format ‘%d’ expects argument of type ‘int*’, but argument 4 has type ‘long long int*’ [-Wformat=]
    7 |     scanf("%d%d%d",&A,&B,&C);
      |                ~^        ~~
      |                 |        |
      |                 int*     long long int*
      |                %lld
main.cpp:7:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |     scanf("%d%d%d",&A,&B,&C);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <iostream>

using namespace std;
int main(void){
    auto start = clock();
    long long A,B,C;
    scanf("%d%d%d",&A,&B,&C);
    long long block,remain;
    block = (A - 1) + B;
    remain  = C % block;
    
    if(remain == 0)
    {
       cout << (C / block) * A;
    }
    else
    {
        cout << (C / block) * A + remain;
    }
}
0