|
|
a , b , c = list(map(int , input().split())) A , B , C = list(map(int , input().split())) if a+c >= A: if a >= A: c =c a-=A else: c=A-a a-=A-c if b+c >= B: if b >= B: c =c b-=B else: c=B-b a-=A-c if a + b + c >= C: print('It is a kind of magic') else: print('There are no miracles in life') else: print('There are no miracles in life') else: print('There are no miracles in life') 1000000000 1000000000 1000000000 0 0 0 answer: It is a kind of magic clarification if you are stuck. RedBlue Mana can be made from red or blue i.e C can use (remA + remB) after using A and B through X and Y respectively. Do count what you use from C when required. I dont understand why difficulty is 121, i think it's easy problem Not everyone is as super smart as you are, Anton. Us plebeians can barely walk upright, much less understand Western Arabic numerals. Congrats on your good fortune! whats problem on test 3?? что за проблема на 3 тесте?? Yep Why my code get WA3? #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <vector> #include <cstring> #include <set> #include <map> #include <cmath> #include <algorithm> using namespace std; #define ll long long const ll nmax = 100005; const ll inf = 1234567890123; ll A, B, C; ll X, Y, Z; int main() { cin>>A>>B>>C; cin>>X>>Y>>Z;
if(Z > C) cout<<"There are no miracles in life"; else { ll ess = (ll)0; if(X > A) ess += X - A; if(Y > B) ess += Y - B; if(C - Z >= ess) cout<<"It is a kind of magic"; else cout<<"There are no miracles in life"; }
return 0; } or more simple #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <vector> #include <cstring> #include <set> #include <map> #include <cmath> #include <algorithm> using namespace std; #define ll long long const ll nmax = 100005; const ll inf = 1234567890123; ll A, B, C; ll X, Y, Z; int main() { cin>>A>>B>>C; cin>>X>>Y>>Z;
if(X > A) C -= (X - A); if(Y > B) C -= (Y - B); if(Z <= C) cout<<"It is a kind of magic"; else cout<<"There are no miracles in life";
return 0; } It's never endless fixing Ok I understand now...It means in blue-red land you can either grab mana from blue or red. Edited by author 11.09.2020 20:18 Edited by author 12.09.2020 17:07 Edited by author 12.09.2020 17:08 My AC code gives "No" on the following testcase due to the overflow 1000000000 1000000000 1000000000 0 0 0 5 6 0 6 5 0 There are no miracles in life 6 5 0 5 6 0 There are no miracles in life 3 6 2 6 5 1 There are no miracles in life 4 6 2 6 5 1 It is a kind of magic I this problem you can choice X+Z, Y or X, Y+Z if you have A, B, C Edited by author 05.12.2019 20:58 |
|
|