| ||||||||||
| 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 | |||||||||
输出直接copy了。。。水题一个,444题纪念#include <iostream>
#include <stdio.h>
using namespace std;
int gs[370][10];
int digit[1000];
const int MX = 366;
int ws_;
int N;
void preProcess(){
ws_ = 1;
digit[0] = 1;
for(int i = 1; i < 1000; i++){
digit[i] = 0;
}
for(int i = 1; i <= MX; i++){
for(int j = 0; j < ws_; j++){
digit[j] *= i;
}
int carry = 0;
for(int j = 0; j < ws_; j++){
digit[j] += carry;
carry = digit[j] / 10;
digit[j] %= 10;
}
while(carry > 0){
digit[ws_] = carry%10;
carry /= 10;
ws_++;
}
for(int j = 0; j < 10; j++){
gs[i][j] = 0;
}
for(int j = 0; j < ws_; j++){
gs[i][digit[j]]++;
}
}
}
bool scan(){
scanf("%d", &N);
return N;
}
void print(){
printf("%d! --\n", N);
printf(" (0)%5d (1)%5d (2)%5d (3)%5d (4)%5d\n (5)%5d (6)%5d (7)%5d (8)%5d (9)%5d\n",
gs[N][0], gs[N][1], gs[N][2], gs[N][3], gs[N][4],
gs[N][5], gs[N][6], gs[N][7], gs[N][8], gs[N][9]);
}
int main() {
preProcess();
while(scan()) print();
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator