Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
c2p
//g++ 7.4.0 #include <bits/stdc++.h> using namespace std; double cof3(int k,int l,int factor) { int i; double p = 2; double x = 1; for(i=1;i<=factor/2;i++) { x += (i*8)/p; p = p*2; } if(k==factor/2 && l==factor/2) return 1/x; p = 2; for(i=1;i<=factor/2;i++) { if(-i<=(k-factor/2) && (k-factor/2)<=i && -i<=(l-factor/2) && (l-factor/2)<=i) return (1.0/(p*x)); p = p*2; } } int main() { double sum =0; int factor = 8; for(int i=0;i<=factor;i++) { for(int j=0;j<=factor;j++) { cout<<cof3(i,j,factor)<<" "; sum += cof3(i,j,factor); } cout<<endl; } cout<<sum<<endl; }
run
|
edit
|
history
|
help
0
Test 14(2020)
hack qus
Test 15(2020)
Undefined behaviour
MAC
Polyrmophism
Iviewb
execution of constructor and destructor
vector fr
Gauss 4x4