結果
問題 | No.208 王将 |
ユーザー |
![]() |
提出日時 | 2018-05-15 21:05:14 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 979 bytes |
コンパイル時間 | 1,212 ms |
コンパイル使用メモリ | 157,408 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-28 12:11:03 |
合計ジャッジ時間 | 1,956 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 23 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:6:24: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 6 | #define SCD2(m,n) scanf("%d%d",&m,&n) | ~~~~~^~~~~~~~~~~~~~ main.cpp:25:18: note: in expansion of macro ‘SCD2’ 25 | int x,y; SCD2(x,y); | ^~~~ main.cpp:6:24: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 6 | #define SCD2(m,n) scanf("%d%d",&m,&n) | ~~~~~^~~~~~~~~~~~~~ main.cpp:26:20: note: in expansion of macro ‘SCD2’ 26 | int x2,y2; SCD2(x2,y2); | ^~~~
ソースコード
#include <bits/stdc++.h>#define FOR(i,a,b) for(int i=(a);i<(b);++i)#define REP(i,n) for(int i=0;i<(n);++i)#define FORq(i, m, n) for(int i = (m);i <= (n);++i)#define SCD(n) scanf("%d",&n)#define SCD2(m,n) scanf("%d%d",&m,&n)#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)#define PB push_back#define MP make_pair#define ARSCD(A,N) REP(i,N){SCD(A[i]);}#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}#define PRINTD(n) printf("%d\n",n)#define PRINTLLD(n) printf("%lld\n",n)#define DEBUG printf("%s\n","debug")#define fst first#define snd second#define IN(x,S) (S.count(x) != 0)using namespace std;typedef pair<int,int> PII;typedef vector<int> VI;typedef long long ll;//////////////////////////////////////////////////////int main(){int x,y; SCD2(x,y);int x2,y2; SCD2(x2,y2);int ans = 0;if (x != y) {ans = max(x,y);}else if (x2 == y2) {if (abs(x2) < abs(x)){ans = x+1;}else{ans = x;}}else{ans = x;}PRINTD(ans);return 0;}