讨论 / AC100纪念
officeyutong 2017-04-16 15:08:40
点我顶贴 收藏 删除
#include <cstdio>

#include <cstdlib>

#include <cmath>

#include <cstring>

#include <iostream>

typedef long long int lli;

using namespace std;

int main() {

/* */ lli begin, end;

/* */ cin >> begin >> end;

/* */ int* bucket = new int[10];

/* */ memset(bucket, 0, sizeof(int) * 10);

/* */ char * currNum = new char[12];

/* */ for (lli i = begin; i <= end; i++) {

/* */ int length = sprintf(currNum, "%lld", i);

/* */ for (int j = 0; j < length; j++) {

/* */bucket[currNum[j] - 0x30]++;

/* */ }

/* */ }

/* */ for (int i = 0; i < 10; i++) {

/* */cout << bucket[i] << " ";

/* */ }

/* */ delete[] currNum;

/* */ delete[] bucket;

}

查看更多回复
提交回复