結果
問題 | No.3031 (物理学)長距離相互作用 |
ユーザー | 夕叢霧香(ゆうむらきりか) |
提出日時 | 2018-02-28 22:53:24 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 3 ms / 10,000 ms |
コード長 | 1,712 bytes |
コンパイル時間 | 549 ms |
コンパイル使用メモリ | 68,992 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-07 15:08:30 |
合計ジャッジ時間 | 1,116 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,376 KB |
testcase_02 | AC | 2 ms
5,376 KB |
testcase_03 | AC | 2 ms
5,376 KB |
testcase_04 | AC | 2 ms
5,376 KB |
testcase_05 | AC | 2 ms
5,376 KB |
testcase_06 | AC | 2 ms
5,376 KB |
testcase_07 | AC | 3 ms
5,376 KB |
testcase_08 | AC | 2 ms
5,376 KB |
testcase_09 | AC | 2 ms
5,376 KB |
testcase_10 | AC | 2 ms
5,376 KB |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:72:25: warning: 'coef[1]' is used uninitialized [-Wuninitialized] 72 | else if(i==7)coef[1]+=c; | ~~~~~~~^~~ main.cpp:68:10: note: 'coef[1]' was declared here 68 | double coef[5]; | ^~~~ main.cpp:78:12: warning: 'coef[4]' is used uninitialized [-Wuninitialized] 78 | coef[4]+=c; | ~~~~~~~^~~ main.cpp:68:10: note: 'coef[4]' was declared here 68 | double coef[5]; | ^~~~ main.cpp:82:15: warning: 'coef[3]' may be used uninitialized [-Wmaybe-uninitialized] 82 | ans-=coef[3]*gh; | ~~~~~~~^~~ main.cpp:68:10: note: 'coef[3]' was declared here 68 | double coef[5]; | ^~~~
ソースコード
#include<algorithm> #include<iostream> #include<vector> using namespace std; typedef long long lint; typedef vector<int>vi; typedef pair<int,int>pii; #define rep(i,n)for(int i=0;i<(int)(n);++i) const double ans1=-1.1638780202724224; const double ans2=-1.3555525130426718; const double ans3=-2.520652485800895; const double ans4=-1.995873239222159; const int DEBUG=0; #if 0 int main(){ double coef[5]; rep(i,8) { double c;cin>>c; if(i==0)coef[0]+=c; else if(i==7)coef[1]+=c; else if(i==1||i==2||i==4)coef[2]+=c; else coef[3]+=c; } rep(i,8){ double c;cin>>c; coef[4]+=c; } if(DEBUG){ cerr<<"coef:"; rep(i,5)cerr<<" "<<coef[i]; cerr<<endl; } double ef=ans2/2*3; double gh=ef-ans3; printf("E-F=%.15f\n",ef); printf("G-H=%.15f\n",gh); double ans;cin>>ans; if(DEBUG){ cerr<<coef[0]<<"E+"<<coef[1]<<"F+"<<coef[2]<<"G+"<<coef[3]<<"H+"<< coef[4]<<"I="<<ans<<endl; } double tmp=ans; { tmp+=coef[1]*ef; coef[0]+=coef[1]; coef[1]=0; } { tmp+=coef[3]*gh; coef[2]+=coef[3]; coef[3]=0; } if(DEBUG){ cerr<<coef[0]<<"E+"<<coef[1]<<"F+"<<coef[2]<<"G+"<<coef[3]<<"H+"<< coef[4]<<"I="<<tmp<<endl; } double egi=tmp/coef[0]; printf("E+3G-4I=%.15f\n",egi); } #else double ef=-2.033328769564008; double gh=0.487323716236888; double egi=-2.320490592729002; int main(){ double coef[5]; rep(i,8) { double c;cin>>c; if(i==0)coef[0]+=c; else if(i==7)coef[1]+=c; else if(i==1||i==2||i==4)coef[2]+=c; else coef[3]+=c; } rep(i,8){ double c;cin>>c; coef[4]+=c; } double ans=0; ans-=coef[1]*ef; ans-=coef[3]*gh; ans+=-coef[4]/4*egi; printf("%.15f\n",ans); } #endif