結果
問題 |
No.208 王将
|
ユーザー |
![]() |
提出日時 | 2015-05-15 22:34:02 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 926 bytes |
コンパイル時間 | 829 ms |
コンパイル使用メモリ | 90,016 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-06 04:06:17 |
合計ジャッジ時間 | 1,262 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 2 |
other | WA * 23 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:30:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 30 | scanf("%lld%lld%lld%lld", &x, &y, &x2, &y2); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include<iostream> #include<cstdio> #include<cstring> #include<string> #include<cctype> #include<cstdlib> #include<algorithm> #include<bitset> #include<vector> #include<list> #include<deque> #include<queue> #include<map> #include<set> #include<stack> #include<cmath> #include<sstream> #include<fstream> #include<iomanip> #include<ctime> #include<complex> #include<functional> #include<climits> #include<cassert> #include<iterator> using namespace std; int main(){ long long int x, y, x2, y2; scanf("%lld%lld%lld%lld", &x, &y, &x2, &y2); long long int xx = abs(y); long long int yy = abs(x); long long int k = min(xx, yy); long long int aa = xx - k + yy - k + k; if (xx == yy){ if (abs(x2) == abs(y2)){ if (x / abs(x) == x2 / abs(x2) && y / abs(y) == y2 / abs(y2)){ if (abs(x2) <= abs(x) && abs(y2) <= abs(y)){ aa += 2LL; } } } } long long int ans = aa; printf("%lld\n", ans-2LL); return 0; }