Server IP : 172.16.15.8 / Your IP : 18.218.71.21 Web Server : Apache System : Linux zeus.vwu.edu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Wed Nov 6 14:29:02 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.2.24 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0705) : /home/cjabbott/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
#include <iostream> using namespace std; int main() { float total, n1, n2, n3; string ans; cin >> total >> n1 >> n2 >> n3; while(int(total) != 0 ||int(n1) != 0 ||int(n2) != 0 || int(n3) != 0) { float temp = n1 * 9 + n2 * 4 + n3 * 4; //cout << total << "\t" << n1 << "\t" << n2 << "\t" << n3 << endl; if(temp > total) { if(n1 != 0) n1 = n1 - 0.5; if(n2 != 0) n2 = n2 - 0.5; if(n3 != 0) n3 = n3 - 0.5; temp = n1 * 9 + n2 * 4 + n3 * 4; if(temp < total) ans = "yes"; else ans = "no"; } else { n1 = n1 + 0.5; n2 = n2 + 0.5; n3 = n3 + 0.5; temp = n1 * 9 + n2 * 4 + n3 * 4; if(temp > total) ans = "yes"; else ans = "no"; } cout << ans << endl; cin >> total >> n1 >> n2 >> n3; } return 0; }