Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
看看我的#include<iostream> using namespace std; void ChangTo(int num) { int i=num; int j; int n=0; int lastnum=0; int f; while (i) { j=i%10; if (j>4) { j-=1; } for(int k=0; k<n; k++) { j*=9; } lastnum+=j; i/=10; n++; } cout<<num<<": "<<lastnum<<endl; } int main() { int num; while(cin>>num) { if (!num) { break; } ChangTo(num); } return 1; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator