# 11/04 可憐的我被C++搞慘了 ### 問題 (感覺是對的但是*WRONG ANS*) 1. TOJ98 (toj.tfcis.org/oj/pro/98/) ```C++= #include<iostream> using namespace std; int main(){ long long c=299792458; cout<<"1 Light-second(LS) is "<<c<<" metres."<<'\n' <<"1 Light-minute(LM) is "<<c*60<<" metres."<<'\n' <<"1 Light-hour(LH) is "<<c*60*60<<" metres."<<'\n' <<"1 Light-day(LD) is "<<c*60*60*24<<" metres."<<'\n' <<"1 Light-week(LW) is "<<c*60*60*24*7<<" metres."<<'\n' <<"1 Light-year(LY) is "<<c*60*60*24*7*365<<" metres."<<'\n'; return 0; } ``` 更:一年=c*60*60*24*365 ----------- 2. TOJ102 (toj.tfcis.org/oj/pro/102/) ```C++= #include<iostream> #include<iomanip> using namespace std; int main(){ double a,b; char c; cin>>a>>c>>b; if (c== 43){ cout<<a<<" + "<<b<<" = "<<fixed<<setprecision(4) <<a+b<<'\n'; } else if (c== 45){ cout<<a<<" - "<<b<<" = "<<fixed<<setprecision(4)<<a-b<<'\n'; } else if (c== 42){ cout<<a<<" * "<<b<<" = "<<fixed<<setprecision(4)<<a*b<<'\n'; } else if (b==0){ cout<<"ERROR"<<'\n'; } else { cout<<a<<" / "<<b<<" = "<<fixed<<setprecision(4)<<a/b<<'\n'; } return 0; } ``` 3. TOJ103 (toj.tfcis.org/oj/pro/103/) ```c++= #include<iostream> using namespace std; int main(){ string a,b; int c,d; cin>>a>>c>>b>>d; if (a==b&&c==d) cout<<"GOOD\n"; else if (a==b||c==d) cout<<"=~=\n"; else cout<<"OTZ\n"; return 0; } ``` 4. TOJ107 (toj.tfcis.org/oj/pro/107/) ```C++= #include<iostream> using namespace std; int main(){ long long n=0; for (int i=1;i<=30;i++ ) { n+=(i+i+(i*(i+1)*i/2)); } cout<<n<<'\n'; return 0; } ``` 5. TOJ109 (toj.tfcis.org/oj/pro/109/) ```C++= #include<iostream> using namespace std; int main(){ int n,f; cin>>n; for (int i=0;i<n;i++) { int a,b; cin>>a>>b; if (a==0) { if (b==2) f--; else if (b==5) f++; } else if (a==2) { if (b==0) f++; else if (b==5) f--; } else { if (b==0) f--; else if (b==2) f++; } } if (f==0) cout<<"The referee wins.\n"; else if (f>0) cout<<"The princess wins.\n"; else cout<<"The prince wins.\n"; return 0; } ``` so that's it... time: 11/04 P.M. 11:02