結果
問題 | No.863 計算量 |
ユーザー |
|
提出日時 | 2019-08-16 21:27:43 |
言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 661 bytes |
コンパイル時間 | 717 ms |
コンパイル使用メモリ | 126,664 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-30 14:31:23 |
合計ジャッジ時間 | 1,277 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 |
コンパイルメッセージ
main.cpp:24:8: warning: absolute value function 'abs' given an argument of type 'lli' (aka 'long long') but has parameter of type 'int' which may cause truncation of value [-Wabsolute-value] 24 | if(abs(A1 - b) < abs(A2 - b)) puts("1"); | ^ main.cpp:24:8: note: use function 'std::abs' instead 24 | 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 'lli' (aka 'long long') but has parameter of type 'int' which may cause truncation of value [-Wabsolute-value] 24 | if(abs(A1 - b) < abs(A2 - b)) puts("1"); | ^ main.cpp:24:22: note: use function 'std::abs' instead 24 | if(abs(A1 - b) < abs(A2 - b)) puts("1"); | ^~~ | std::abs 2 warnings generated.
ソースコード
#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;}