結果
問題 | No.281 門松と魔法(1) |
ユーザー | y32M-71693993 |
提出日時 | 2015-09-27 20:49:40 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,677 bytes |
コンパイル時間 | 1,354 ms |
コンパイル使用メモリ | 159,420 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-06 19:42:53 |
合計ジャッジ時間 | 2,544 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,816 KB |
testcase_01 | AC | 2 ms
6,816 KB |
testcase_02 | WA | - |
testcase_03 | AC | 1 ms
6,816 KB |
testcase_04 | AC | 2 ms
6,816 KB |
testcase_05 | AC | 2 ms
6,820 KB |
testcase_06 | AC | 2 ms
6,820 KB |
testcase_07 | AC | 1 ms
6,820 KB |
testcase_08 | AC | 2 ms
6,816 KB |
testcase_09 | AC | 2 ms
6,824 KB |
testcase_10 | AC | 2 ms
6,816 KB |
testcase_11 | AC | 2 ms
6,816 KB |
testcase_12 | AC | 1 ms
6,816 KB |
testcase_13 | AC | 2 ms
6,816 KB |
testcase_14 | AC | 2 ms
6,820 KB |
testcase_15 | AC | 2 ms
6,816 KB |
testcase_16 | AC | 1 ms
6,820 KB |
testcase_17 | AC | 2 ms
6,816 KB |
testcase_18 | AC | 2 ms
6,816 KB |
testcase_19 | AC | 1 ms
6,816 KB |
testcase_20 | AC | 1 ms
6,816 KB |
testcase_21 | AC | 2 ms
6,820 KB |
testcase_22 | AC | 2 ms
6,816 KB |
testcase_23 | AC | 2 ms
6,816 KB |
testcase_24 | AC | 1 ms
6,820 KB |
testcase_25 | WA | - |
testcase_26 | AC | 2 ms
6,816 KB |
testcase_27 | AC | 2 ms
6,816 KB |
testcase_28 | AC | 2 ms
6,816 KB |
testcase_29 | AC | 2 ms
6,816 KB |
testcase_30 | WA | - |
testcase_31 | AC | 2 ms
6,816 KB |
testcase_32 | AC | 1 ms
6,816 KB |
testcase_33 | WA | - |
testcase_34 | AC | 2 ms
6,816 KB |
testcase_35 | WA | - |
testcase_36 | AC | 1 ms
6,816 KB |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | WA | - |
testcase_45 | AC | 2 ms
6,816 KB |
testcase_46 | AC | 1 ms
6,816 KB |
testcase_47 | AC | 2 ms
6,820 KB |
testcase_48 | AC | 1 ms
6,816 KB |
testcase_49 | AC | 2 ms
6,816 KB |
testcase_50 | AC | 2 ms
6,816 KB |
testcase_51 | WA | - |
testcase_52 | AC | 2 ms
6,820 KB |
testcase_53 | AC | 2 ms
6,816 KB |
testcase_54 | WA | - |
testcase_55 | AC | 1 ms
6,816 KB |
testcase_56 | WA | - |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:38:27: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 38 | #define SCANF_INT(a) scanf("%d", &(a)); | ~~~~~^~~~~~~~~~~~ main.cpp:14:9: note: in expansion of macro ‘SCANF_INT’ 14 | FIRST(A) NEXT(B) NEXT(C) NEXT(D) | ^~~~~ main.cpp:5:69: note: in expansion of macro ‘EXPAND_04’ 5 | #define GET_MACRO_09(A1, A2, A3, A4, A5, A6, A7, A8, A9, NAME, ...) NAME | ^~~~ main.cpp:29:28: note: in expansion of macro ‘EXPAND_ADD’ 29 | #define EXPAND(MACRO, ...) EXPAND_ADD(MACRO, MACRO, __VA_ARGS__) | ^~~~~~~~~~ main.cpp:41:33: note: in expansion of macro ‘EXPAND’ 41 | #define I(...) int __VA_ARGS__; EXPAND(SCANF_INT, __VA_ARGS__); | ^~~~~~ main.cpp:95:9: note: in expansion of macro ‘I’ 95 | I(d, h1, h2, h3); | ^ main.cpp:38:27: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 38 | #define SCANF_INT(a) scanf("%d", &(a)); | ~~~~~^~~~~~~~~~~~ main.cpp:14:18: note: in expansion of macro ‘SCANF_INT’ 14 | FIRST(A) NEXT(B) NEXT(C) NEXT(D) | ^~~~ main.cpp:5:69: note: in expansion of macro ‘EXPAND_04’ 5 | #define GET_MACRO_09(A1, A2, A3, A4, A5, A6, A7, A8, A9, NAME, ...) NAME | ^~~~ main.cpp:29:28: note: in expansion of macro ‘EXPAND_ADD’ 29 | #define EXPAND(MACRO, ...) EXPAND_ADD(MACRO, MACRO, __VA_ARGS__) | ^~~~~~~~~~ main.cpp:41:33: note: in expansion of macro ‘EXPAND’ 41 | #define I(...) int __VA_ARGS__; EXPAND(SCANF_INT, __V
ソースコード
#include <bits/stdc++.h> using namespace std; // Macro Tools ///////////////////////////////////////////////////////////////// #define GET_MACRO_09(A1, A2, A3, A4, A5, A6, A7, A8, A9, NAME, ...) NAME #define EXPAND_01(FIRST, NEXT, A) \ FIRST(A) #define EXPAND_02(FIRST, NEXT, A, B) \ FIRST(A) NEXT(B) #define EXPAND_03(FIRST, NEXT, A, B, C) \ FIRST(A) NEXT(B) NEXT(C) #define EXPAND_04(FIRST, NEXT, A, B, C, D) \ FIRST(A) NEXT(B) NEXT(C) NEXT(D) #define EXPAND_05(FIRST, NEXT, A, B, C, D, E) \ FIRST(A) NEXT(B) NEXT(C) NEXT(D) NEXT(E) #define EXPAND_06(FIRST, NEXT, A, B, C, D, E, F) \ FIRST(A) NEXT(B) NEXT(C) NEXT(D) NEXT(E) NEXT(F) #define EXPAND_07(FIRST, NEXT, A, B, C, D, E, F, G) \ FIRST(A) NEXT(B) NEXT(C) NEXT(D) NEXT(E) NEXT(F) NEXT(G) #define EXPAND_08(FIRST, NEXT, A, B, C, D, E, F, G, H) \ FIRST(A) NEXT(B) NEXT(C) NEXT(D) NEXT(E) NEXT(F) NEXT(G) NEXT(H) #define EXPAND_09(FIRST, NEXT, A, B, C, D, E, F, G, H, I) \ FIRST(A) NEXT(B) NEXT(C) NEXT(D) NEXT(E) NEXT(F) NEXT(G) NEXT(H) NEXT(I) #define EXPAND_ADD(FIRST, NEXT, ...) \ GET_MACRO_09(__VA_ARGS__, EXPAND_09, EXPAND_08, EXPAND_07, EXPAND_06, \ EXPAND_05, EXPAND_04, EXPAND_03, EXPAND_02, EXPAND_01) \ (FIRST, NEXT, __VA_ARGS__) #define EXPAND(MACRO, ...) EXPAND_ADD(MACRO, MACRO, __VA_ARGS__) #define Q(x) #x #define QUOTE(x) Q(x) // Input /////////////////////////////////////////////////////////////////////// #define RIGHT_SHIFT_BEFORE(a) >>a #define CAMMA_AND_ADDRESS(a) , &a #define INT_FORMATTER(a) %d #define SCANF_INT(a) scanf("%d", &(a)); // #define SCANF_LL(a) scanf("%I64d", &(a)); #define I(...) int __VA_ARGS__; EXPAND(SCANF_INT, __VA_ARGS__); // #define L(...) long long __VA_ARGS__; EXPAND(SCANF_LL, __VA_ARGS__); #define input(t,v) t v;cin>>v; #define input2(t,v1,v2) t v1,v2;cin>>v1>>v2; #define input3(t,v1,v2,v3) t v1,v2,v3;cin>>v1>>v2>>v3; #if __cplusplus > 199711L //C++11 template<class T=int> #else template<class T> #endif T read() { T t; cin >> t; return t; } // Types /////////////////////////////////////////////////////////////////////// typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef set<int> si; typedef set<ll, ll> sll; typedef vector<int> vi; typedef vector<ll> vll; typedef list<int> li; typedef list<ll> lll; typedef map<int, int> mii; typedef map<int, ll> mil; typedef map<ll, int> mli; typedef map<ll, ll> mll; // Loop & Iteration //////////////////////////////////////////////////////////// #define FOR(i, a, b) for(int i = (a), loop_end_##i=(b); i < (loop_end_##i); i++) #define REP(i, n) FOR(i, 0, n) #define rep(v,n) for(int (v)=0;(v)<(n);(v)++) #define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i) #define SORT(c) sort((c).begin(),(c).end()) #define EXIST(s,e) ((s).find(e)!=(s).end()) #define PB push_back // Range /////////////////////////////////////////////////////////////////////// #define IN(x, a, b) (a<=x && x<b) int dx[8] = { 1, 0, 0,-1, 1, 1,-1,-1}; int dy[8] = { 0,-1, 1, 0,-1, 1,-1, 1}; // Debug /////////////////////////////////////////////////////////////////////// #define dump(x) cout << #x << " = " << (x) << endl #define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl //////////////////////////////////////////////////////////////////////////////// int main(){ I(d, h1, h2, h3); if(h1==0 && h2==0 && h3==0){ printf("-1\n"); return 0; } if(((h1>h2 && h2<h3) || (h1<h2 && h2>h3))){ printf("0\n"); return 0; } if(d==0){ printf("-1\n"); return 0; } int ans1=INT_MAX; if (min(h1, h3)){ int low = min(h1, h3)-1; ans1=(h2-low+d-1)/d; } int ans2=(max(h1, h3)-(h2-1)+d-1)/d; printf("%d\n", min(ans1, ans2)); }