結果

問題 No.863 計算量
ユーザー WarToksWarToks
提出日時 2019-08-16 21:27:43
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 661 bytes
コンパイル時間 852 ms
コンパイル使用メモリ 93,672 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-20 12:43:26
合計ジャッジ時間 1,424 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,384 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:24:8: warning: absolute value function 'abs' given an argument of type 'long long' but has parameter of type 'int' which may cause truncation of value [-Wabsolute-value]
    if(abs(A1 - b) < abs(A2 - b)) puts("1");
       ^
main.cpp:24:8: note: use function 'std::abs' instead
    if(abs(A1 - b) < abs(A2 - b)) puts("1");
       ^~~
       std::abs
main.cpp:24:22: warning: absolute value function 'abs' given an argument of type 'long long' but has parameter of type 'int' which may cause truncation of value [-Wabsolute-value]
    if(abs(A1 - b) < abs(A2 - b)) puts("1");
                     ^
main.cpp:24:22: note: use function 'std::abs' instead
    if(abs(A1 - b) < abs(A2 - b)) puts("1");
                     ^~~
                     std::abs
2 warnings generated.

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <tuple>
#include <cstring>


#define REP(i, n) for(int (i) = 0; (i) < (n); ++(i))
#define eREP(i, n) for(int (i) = 0; (i) <= (n); ++(i))
#define ALL(TheArray) TheArray.begin(), TheArray.end()

template <class T> inline T& chmax(T& a, T b){return (a < b) ? a = b : a;}
template <class T> inline T& chmin(T& a, T b){return (a > b) ? a = b : a;}

using lli = long long int;


constexpr int T = 200000 / 5000;
int main(void){
    lli a, b; std::cin >> a >> b;
    // P * N = 
    lli A1 = a * T;
    lli A2 = A1 * T;
    if(abs(A1 - b) < abs(A2 - b)) puts("1");
    else puts("2");
    return 0;
}
0