Posted on 2008-12-31 21:37
Hero 阅读(99)
评论(0) 编辑 收藏 引用 所属分类:
代码如诗--ACM
1 // 1083 C++ Accepted 0.015 121 KB
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <string.h>
5
6 int inn, ink ;
7 char str[30] ;
8
9 int main()
10 {
11 scanf( "%d", &inn ) ; getchar() ;
12 scanf( "%s", str ) ; ink = strlen( str ) ;
13
14 long long out = 1 ;
15 if( 0 == inn % ink )
16 {
17 for( int i=inn; i>=ink; i=i-ink )
18 {
19 out = out * i ;
20 }
21 }
22 else
23 {
24 for( int i=inn; i>0; i=i-ink )
25 out = out * i ;
26 }
27
28 printf( "%I64d\n", out ) ;
29
30 return 0 ;
31 }