2011/07/23

Codeforces Beta Round #78(Div.2) report

(This article is not explanation but my report. Please understand my aim.)

This contest, I get my really score, I think.

A: Once read miss, once coding miss and twice type misses. So, I solve this at 00:23, score=254. It's worst score of A, which I can solve.

B: Accepted with only once submit at 00:36. Score=856. I thought I should solve this first.

C: First Pretest-Passed at 01:03, however it was hacked. So, I search this, and I read here(Japanese). I solved at 01:47 finally. Score=808. However, it is wrong at system test. The miss is my writing miss.

I read D and E, however it's too difficult for me to solve. I'm going to read D's Editrial and solve this.

Result,1110,323/1219. I think this score is a little good for me. And I'd like to practice programming more and more.

A.I cried to many misses.

#include<stdio.h>
#include<string.h>

int main(void){
  char str[1024];
  int i,j,k;
  fgets(str,sizeof(str)/sizeof(char),stdin);
  for(i=0;i<strlen(str);i++){
    if(str[i]=='.'){
      if(str[i-1]=='9'){
puts("GOTO Vasilisa.");
return 0;
      }
      if(str[i+1]>='5'){
 str[i-1]++;
      }
      for(j=0;j<i;j++) putchar(str[j]);
      putchar('\n');
      return 0;
    }
  }
}


B.It's easy for me.

#include<stdio.h>

int sum(int array[],int size){
  int sum=0,i;
  for(i=0;i<size;i++) sum+=array[i];
  return sum;
}
int main(void){
  int cup[1000];
  int n;
  int ave;
  int i,j,k;
  int count=0;
 
  scanf("%u",&n);
  for(i=0;i<n;i++) scanf("%d",&cup[i]);
  ave=sum(cup,n);
  if(ave%n!=0){
    puts("Unrecoverable configuration.");
    return 0;
  }
  ave/=n;
  for(i=0;i<n;i++) cup[i]-=ave;
  for(i=0;i<n;i++) count+=(cup[i]!=0);
  if(count==0){
    puts("Exemplary pages.");
    return 0;
  }else if(count!=2){
    puts("Unrecoverable configuration.");
    return 0;
  }else{
    for(i=0;i<n;i++){
      if(cup[i]<0){
j=i;
count--;
      }else if(cup[i]>0){
k=i;
count--;
      }
      if(count==0) break;
    }
    printf("%d ml. from cup #%d to cup #%d.\n",cup[k],j+1,k+1);
  }
  return 0;
}



C.If I found the page earlier, I may get accepted first.

#include<stdio.h>

int main(void){
  int color[6],i,kosu[7];
  char str[8];
  fgets(str,sizeof(str),stdin);
  for(i=0;i<6;i++) color[i]=0;
  for(i=0;i<6;i++){
    switch(str[i]){
    case 'R':
      color[0]++;
      break;
    case 'O':
      color[1]++;
      break;
    case 'Y':
      color[2]++;
      break;
    case 'G':
      color[3]++;
      break;
    case 'B':
      color[4]++;
      break;
    case 'V':
      color[5]++;
      break;
    }
  }
  for(i=0;i<7;i++) kosu[i]=0;
  for(i=0;i<6;i++) kosu[color[i]]++;
 
  if(kosu[6]==1 || kosu[5]==1){
    puts("1");
  }else if(kosu[4]==1 || kosu[3]==2){
    puts("2");
  }else if(kosu[3]==1){
    puts("5");
  }else if(kosu[2]==3){
    puts("6");
  }else if(kosu[2]==2){
    puts("8");
  }else if(kosu[2]==1){
    puts("15");
  }else{
    puts("30");
  }
  return 0;
}

0 件のコメント:

コメントを投稿