結果

問題 No.734 Careful Engineer
ユーザー greentea011greentea011
提出日時 2018-10-04 10:21:20
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 275 bytes
コンパイル時間 235 ms
コンパイル使用メモリ 30,336 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-20 15:31:44
合計ジャッジ時間 824 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 1 ms
6,940 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 1 ms
6,940 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 1 ms
6,940 KB
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:14: warning: format ‘%ld’ expects argument of type ‘long int*’, but argument 2 has type ‘double*’ [-Wformat=]
    6 |     scanf("%ld %ld %ld", &a, &b, &c);
      |            ~~^           ~~
      |              |           |
      |              long int*   double*
      |            %le
main.cpp:6:18: warning: format ‘%ld’ expects argument of type ‘long int*’, but argument 3 has type ‘double*’ [-Wformat=]
    6 |     scanf("%ld %ld %ld", &a, &b, &c);
      |                ~~^           ~~
      |                  |           |
      |                  long int*   double*
      |                %le
main.cpp:6:22: warning: format ‘%ld’ expects argument of type ‘long int*’, but argument 4 has type ‘double*’ [-Wformat=]
    6 |     scanf("%ld %ld %ld", &a, &b, &c);
      |                    ~~^           ~~
      |                      |           |
      |                      long int*   double*
      |                    %le
main.cpp:6:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |     scanf("%ld %ld %ld", &a, &b, &c);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <math.h>

int main() {
    double a,b,c;
    scanf("%ld %ld %ld", &a, &b, &c);

    double x = c / (a-b);
    int ans;
    if (x < 0) {
        ans = -1;
    }
    else {
        ans = (int) ceil(x);
    }
    printf("%d\n", ans);
    return 0;
}
0