結果
| 問題 |
No.8031 (物理学)長距離相互作用
|
| ユーザー |
夕叢霧香(ゆうむらきりか)
|
| 提出日時 | 2018-02-28 22:49:01 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,678 bytes |
| コンパイル時間 | 852 ms |
| コンパイル使用メモリ | 69,120 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-25 21:08:11 |
| 合計ジャッジ時間 | 1,504 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 9 WA * 2 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:71:25: warning: 'coef[1]' is used uninitialized [-Wuninitialized]
71 | else if(i==7)coef[1]+=c;
| ~~~~~~~^~~
main.cpp:67:10: note: 'coef[1]' was declared here
67 | double coef[5];
| ^~~~
main.cpp:77:12: warning: 'coef[4]' is used uninitialized [-Wuninitialized]
77 | coef[4]+=c;
| ~~~~~~~^~~
main.cpp:67:10: note: 'coef[4]' was declared here
67 | double coef[5];
| ^~~~
main.cpp:81:15: warning: 'coef[3]' may be used uninitialized [-Wmaybe-uninitialized]
81 | ans-=coef[3]*gh;
| ~~~~~~~^~~
main.cpp:67:10: note: 'coef[3]' was declared here
67 | 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 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=ans2/2-ans1;
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.486101763751086;
double egi=-2.323933631643025;
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
夕叢霧香(ゆうむらきりか)