⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 1916.cpp

📁 HDOJ acm.hdu.edu.cn 第10卷的一些题目
💻 CPP
字号:
//1916
#include <cstdio>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;
int cnt[10];
char str[110];
int main() {
	int i,j,cas;
	int s,e,step;
	scanf("%d",&cas);
	getchar(); gets(str);
	while (cas --) {
		memset(cnt,0,sizeof(cnt));
		puts(str);
		gets(str); puts(str);
		while (gets(str)) {
			if (str[0] == '+') {
				sscanf(str+1,"%d %d %d",&s,&e,&step);
				for (i=s;i<=e;i+=step) {
					int t = i;
					while (t) {
						cnt[t%10] ++;
						t /= 10;
					}
				}
			}
			else if (sscanf(str,"%d",&s)==1) {
				while (s) {
					cnt[s%10] ++;
					s /= 10;
				}
			}
			else break;
		}
		for (i=s=0;i<=9;i++) {
			printf("Make %d digit %d\n",cnt[i],i);
			s += cnt[i];
		}
		if (s > 1) printf("In total %d digits\n",s);
		else puts("In total 1 digit");
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -