ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1263. Elections

WA#1
Posted by Urffin_Witeman 28 Oct 2007 03:40
whats wrong with my code? i'd check it but i'v got WA#1
#include <stdio.h>
#include <string.h>
/*
//----------------------------------------------------------------------
void sort(int* in,int a,int b)
{
 int i,j,mode;
 if(a>=b)return;
 for(i=a, j=b, mode=1 ; i < j ; mode > 0 ? j--: i++)
 {
  if(in[i]>in[j])
  {
   int c=in[i];
   in[i]=in[j];
   in[j]=c;
   mode=-mode;
  }
 }
 sort(in,a,i-1);
 sort(in,i+1,b);
}
//----------------------------------------------------------------------
int main(int argc, char* argv[])
{
 int *mass,size_s,size_c,counter=1;
 float percent;

 scanf("%d",&size_c);
 scanf("%d",&size_s);

 mass=new int[size_s];

 for(int i=0;i<size_s;i++)scanf("%d",&mass[i]);
 sort(mass,0,size_s);


 for(int i=0;i<size_s;i++,counter++)
 {
  if(mass[i]!=mass[i+1]||i==size_s-1)
  {
     printf("%.2f%%\n",(float)100*counter/size_s);
     counter=0;
  }
 }
 return 0;
}
Re: WA#1
Posted by Madhav 13 Jun 2008 12:54
got accepted :).



Edited by author 13.06.2008 12:57