Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

居然是WA 不可能啊!

Posted by CQQ at 2005-12-07 17:22:18 on Problem 2719
#include<stdio.h>

int main(){
  long n ;
  while(1){
   int i ;
   long temp ,temp1;
   int rest ;
   scanf("%ld",&n);
   temp1=temp = n ;
   if(n == 0 ){
     break;
   }
   else{
     for(i = 0 ; temp > 0 ; i++){
      rest = temp % 10 ;
      temp /=10 ;
      if(rest>4){
        temp++;
        n -= temp*pow(9,i);
      }
      else{
        n -= temp*pow(9,i);
      }
     } 
   }
   printf("%ld: %ld\n",temp1,n);
  }
  return 0 ;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator