| ||||||||||
| 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 | |||||||||
高精度,而且要打表In Reply To:第一次参加,请高手帮我指正 Posted by:youngtree at 2007-08-11 14:18:46 > 总是wrong answer,耽误一点时间,谢谢。
>
> #include <iostream>
> using namespace std;
>
> int count_num(int i,int j)
> {
> int res=0;
>
> int prod=1;
> for(int k=1;k<=i;++k)
> {
> prod *= k;
> }
>
> while(prod!=0)
> {
> if((prod-(prod/10)*10)==j)
> {
> res++;
> }
> prod /= 10;
> }
> return res;
> }
>
> int main(int argc,char* argv[])
> {
> int num=0;
> cin>>num;
> for(int k=0;k<num;++k)
> {
> int i=0,j=0;
> cin>>i>>j;
>
> cout<<count_num(i,j)<<endl;
> }
> return 0;
> }
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator