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

终于找到了一个水题,晚上11點以后就适合刷刷这种题

Posted by KatrineYang at 2016-09-09 11:13:05 on Problem 1316 and last updated at 2016-09-09 11:13:56
#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:
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