結果
| 問題 |
No.8031 (物理学)長距離相互作用
|
| ユーザー |
Hoi_koro
|
| 提出日時 | 2018-03-03 12:04:12 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 10,000 ms |
| コード長 | 4,126 bytes |
| コンパイル時間 | 1,848 ms |
| コンパイル使用メモリ | 170,684 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-23 21:14:53 |
| 合計ジャッジ時間 | 2,757 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 |
ソースコード
#include <bits/stdc++.h>
//make_tuple emplace_back next_permutation push_back make_pair second first setprecision
#if MYDEBUG
#include "lib/cp_debug.hpp"
#else
#define DBG(...) ;
#endif
using LL = long long;
constexpr LL LINF=334ll<<53;
constexpr int INF=15<<26;
constexpr LL MOD=1E9+7;
namespace Problem{
using namespace std;
class Writer{
static ostringstream oss;
public:template<class T> void appendln(const vector<vector<T>> &ans,string spl=" ", string el="\n"){for(int i=0; i<(int)ans.size(); ++i){for(int j=0; j<(int)ans[i].size(); ++j){oss << ans[i][j];oss << (j==(int)ans[i].size()-1?el:spl);}}}
template<class T> void appendln(const vector<T>& ans, string spl=" "){for(int i=0; i<(int)ans.size(); ++i){oss << ans[i] << (i==(int)ans.size()-1?"\n":spl);}}
template<class T> void appendln(const T& answer){oss << answer << "\n";}
template<class T> void append(const T& answer){oss << answer;}
void appends(const string spl){oss.seekp((int)oss.tellp()-1);oss<<"\n";}
template<class F, class... R>void appends(const string spl,const F& fi, const R&... rest){oss << fi << spl; appends(spl, rest...);}
static void write(){cout << oss.str();}
Writer(){static bool is_single =true;assert(is_single);is_single=false;};
};ostringstream Writer::oss;
class Solver{
public:
double q[4][4][4]={};
double ans = 0.0;
void solve(){
cin >> q[0][0][0];
cin >> q[0][0][2];
cin >> q[0][2][0];
cin >> q[0][2][2];
cin >> q[2][0][0];
cin >> q[2][0][2];
cin >> q[2][2][0];
cin >> q[2][2][2];
cin >> q[1][1][1];
cin >> q[1][1][3];
cin >> q[1][3][1];
cin >> q[1][3][3];
cin >> q[3][1][1];
cin >> q[3][1][3];
cin >> q[3][3][1];
cin >> q[3][3][3];
double e1 = 0.0;
int ub = 5;
int lb = -ub;
double rmax = ub;
double pi = acos(-1.0);
double sigma = 1.0/sqrt(2.0*pi);
vector<double>sump,sumn;
for(int i=lb; i<=ub; ++i){
cerr<<i<<"\n";
for(int j=lb; j<=ub; ++j){
for(int k=lb; k<=ub; ++k){
if(abs(i)+abs(j)+abs(k)>rmax)continue;
for(int d=0; d<=3; ++d){
for(int e=0; e<=3; ++e){
for(int f=0; f<=3; ++f){
if(i==0 and j==0 and k==0 and d==0 and e==0 and f==0)continue;
double tmp = q[d%4][e%4][f%4]*erfc(dist(i,j,k,d,e,f)/sqrt(2.0)/sigma)/dist(i,j,k,d,e,f);
e1 += tmp;
}
}
}
}
}
}
ub = 5;
lb = -ub;
rmax = ub;
double e2 = 0.0;
for(int i=lb; i<=ub; ++i){
for(int j=lb; j<=ub; ++j){
for(int k=lb; k<=ub; ++k){
if(i==0 and j == 0 and k==0)continue;
if(abs(i)+abs(j)+abs(k)>rmax)continue;
double tmp = exp(-2.0*pi*pi*g(i,j,k)*sigma*sigma)/pi/g(i,j,k);
double tmp2 = 0.0;
for(int d=0; d<=3; ++d){
for(int e=0; e<=3; ++e){
for(int f=0; f<=3; ++f){
double tmp3 = q[d%4][e%4][f%4]*cos(2.0*pi*(i*d+j*e+k*f)/4.0);
tmp2+=tmp3;
}
}
}
e2+=tmp*tmp2;
}
}
}
double e3 = q[0][0][0]*sqrt(2.0/pi)/sigma;
cout <<fixed << setprecision(10)<< e1+e2-e3 <<"\n";
}
double dist(double a, double b, double c,double d,double e, double f){
return sqrt(pow(a+d/4.0,2.0)+pow(b+e/4.0,2.0)+pow(c+f/4.0,2.0));
}
double g(double a, double b, double c){
return a*a+b*b+c*c;
}
};
}
int main(){
std::cin.tie(0);
std::ios_base::sync_with_stdio(false);
Problem::Solver sol;
sol.solve();
Problem::Writer::write();
return 0;
}
Hoi_koro