QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#72978 | #5419. Triangles | chenshi | WA | 1ms | 1752kb | C++ | 2.8kb | 2023-01-21 11:27:30 | 2023-01-21 11:27:32 |
Judging History
answer
#include<cstdio>
#include<cmath>
using namespace std;
const int E=1e9,A=16,B=32000,C=1e5;
int k,xa[99],ya[99],xb[99],yb[99],xc[99],yc[99],ans;
int main(){
scanf("%d",&k);
if(k<8){printf("No");return 0;}
if(k%3==2)
ans=8,
xa[1]=0,ya[1]=0,xb[1]=E/2-A,yb[1]=B,xc[1]=0,yc[1]=E,
xa[2]=0,ya[2]=0,xb[2]=E/2-A,yb[2]=B,xc[2]=E/2,yc[2]=0,
xa[3]=0,ya[3]=E,xb[3]=E/2,yb[3]=E,xc[3]=E/2-A,yc[3]=B,
xa[4]=E/2-A,ya[4]=B,xb[4]=E/2+A,yb[4]=B,xc[4]=E/2,yc[4]=E,
xa[5]=E/2-A,ya[5]=B,xb[5]=E/2+A,yb[5]=B,xc[5]=E/2,yc[5]=0,
xa[6]=E,ya[6]=0,xb[6]=E/2+A,yb[6]=B,xc[6]=E,yc[6]=E,
xa[7]=E,ya[7]=0,xb[7]=E/2+A,yb[7]=B,xc[7]=E/2,yc[7]=0,
xa[8]=E,ya[8]=E,xb[8]=E/2,yb[8]=E,xc[8]=E/2+A,yc[8]=B;
else if(k%3==0)
ans=9,
xa[1]=0,ya[1]=0,xb[1]=E,yb[1]=0,xc[1]=7275*C,yc[1]=4950*C,
xa[2]=0,ya[2]=0,xb[2]=0,yb[2]=E,xc[2]=7275*C,yc[2]=4950*C,
xa[3]=E,ya[3]=0,xb[3]=7275*C,yb[3]=4950*C,xc[3]=E,yc[3]=6243*C,
xa[4]=7275*C,ya[4]=4950*C,xb[4]=E,yb[4]=6243*C,xc[4]=8004*C,yc[4]=8176*C,
xa[5]=7275*C,ya[5]=4950*C,xb[5]=8004*C,yb[5]=8176*C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2==yc[i]%2){
xd=(xa[i]+xb[i])/2;yd=(ya[i]+yb[i])/2;
xe=(xb[i]+xc[i])/2;ye=(yb[i]+yc[i])/2;
xf=(xc[i]+xa[i])/2;yf=(yc[i]+ya[i])/2;
xa[ans+1]=xa[i];ya[ans+1]=ya[i];xb[ans+1]=xd;yb[ans+1]=yd;xc[ans+1]=xf;yc[ans+1]=yf;
xa[ans+2]=xb[i];ya[ans+2]=yb[i];xb[ans+2]=xd;yb[ans+2]=yd;xc[ans+2]=xe;yc[ans+2]=ye;
xa[ans+3]=xc[i];ya[ans+3]=yc[i];xb[ans+3]=xe;yb[ans+3]=ye;xc[ans+3]=xf;yc[ans+3]=yf;
xa[i]=xd;ya[i]=yd;
xb[i]=xe;yb[i]=ye;
xc[i]=xf;yc[i]=yf;
break;
}
printf("Yes\n");
for(int i=1;i<=ans;++i) printf("%d %d %d %d %d %d\n",xa[i],ya[i],xb[i],yb[i],xc[i],yc[i]);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 1516kb
input:
2
output:
No
result:
ok no solution
Test #2:
score: 0
Accepted
time: 0ms
memory: 1752kb
input:
24
output:
Yes 562578125 170156250 571093750 154687500 593828125 170156250 0 0 0 1000000000 727500000 495000000 1000000000 0 727500000 495000000 1000000000 624300000 727500000 495000000 1000000000 624300000 800400000 817600000 727500000 495000000 800400000 817600000 494700000 656600000 643000000 1000000000 800...
result:
ok 24 acute triangles
Test #3:
score: 0
Accepted
time: 1ms
memory: 1512kb
input:
1
output:
No
result:
ok no solution
Test #4:
score: 0
Accepted
time: 1ms
memory: 1724kb
input:
3
output:
No
result:
ok no solution
Test #5:
score: 0
Accepted
time: 1ms
memory: 1732kb
input:
4
output:
No
result:
ok no solution
Test #6:
score: 0
Accepted
time: 1ms
memory: 1588kb
input:
5
output:
No
result:
ok no solution
Test #7:
score: 0
Accepted
time: 0ms
memory: 1480kb
input:
6
output:
No
result:
ok no solution
Test #8:
score: 0
Accepted
time: 0ms
memory: 1508kb
input:
7
output:
No
result:
ok no solution
Test #9:
score: -100
Wrong Answer
time: 1ms
memory: 1732kb
input:
8
output:
Yes 0 0 499999984 32000 0 1000000000 0 0 499999984 32000 500000000 0 0 1000000000 500000000 1000000000 499999984 32000 499999984 32000 500000016 32000 500000000 1000000000 499999984 32000 500000016 32000 500000000 0 1000000000 0 500000016 32000 1000000000 1000000000 1000000000 0 500000016 32000 5000...
result:
wrong answer triangle 2 not acute