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 |
终于找到了一个水题,晚上11點以后就适合刷刷这种题#include <iostream> #include <stdio.h> using namespace std; int main() { int gs[10001] = {0}; int digitSum[10001] = {0}; for(int n = 1; n < 10000; n++){ int div = 1; while(n % (10*div) == 0){ div *= 10; } digitSum[n] = digitSum[n-div] + 1; //cout << n << " " << div << " " << digitSum[n] << endl; if(n+digitSum[n] < 10000) gs[n+digitSum[n]]++; } for(int n = 1; n < 10000; n++){ if(gs[n]==0) printf("%d\n", n); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator