Submission #2389

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
23892013-07-21 05:10:03hgp744생일수 II (GA4_birthday2)C++98
0 / 100
0 ms880 KiB
#include<stdio.h>
int main()
{
int n, i, t, j, a, b, c, k, l;
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
scanf("%d", &n);
for(i=1;i<=n;i++){
scanf("%d", &t);
a = b = c = 0;
for(j=t/8;j>=0;j--){
for(k=(t-(j*8))/5;k>=0;k--){
if(j+k+((t-(j*8)-(k*5))/3)>a+b+c && (a!=0 || b!=0 || c!=0)) break;
if((t-(j*8)-(k*5))%3==0){
if(j+k+((t-(j*8)-(k*5))/3)<a+b+c || (a==0 && b==0 && c==0)){
a = j;
b = k;
c = (t-(j*8)-(k*5))/3;
}
else if(j+k+((t-(j*8)-(k*5))/3)==a+b+c){
if(a<j){
a = j;
b = k;
c = (t-(j*8)-(k*5))/3;
}
else if(a==j){
if(b<k){
a = j;
b = k;
c = (t-(j*8)-(k*5))/3;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...