- 积分
- 22100
- 最后登录
- 2012-5-17
- 精华
- 84
- 帖子
- 2734
- 博文
- 205
- UID
- 3
  
|
发表于 2009-8-17 20:09:52
|显示全部楼层
|
1、10个人分成4组 有几种分法?
2、如图:
7 8 9 10
6 1 2 11
5 4 3 12
16 15 14 13
设“1”的坐标为(0,0) “7”的坐标为(-1,-1) 编写一个小程序,使程
序做到输入坐标(X,Y)之后显示出相应的数字。
3、#include
//example input and output
//in 1 2 3 out 1 3 1
//in 123456789 2 100 out 123456789 100 21
long mex(long a,long b,long c)
{ long d;
if(b==0) return 0;
if(b==1) return a%c;
d=mex(a,b/2,c); d*=d;这里忘了;d*=mex(a,b%2,c);d%=c;
return d;
}
int main(void)
{ long x,y,z;
while(1)
{ if(scanf(%d %d %d,&x,&y,&z)>3) return 0;
if(x<0) { printf("too small\n");continue;}
if(y<0) { printf("too small\n");continue;}
if(z<1) { printf("too small\n");continue;}
if(y>z) { printf("too big\n");continue;}
if(z>1000000010) {printf("too big\n");continue}
printf(%d %d %d,x,z,mex(x,y,z);
}}
根据这个程序,当已知一个输入,算出输出,如:输入 1 3 1 则输出 1 2 3 输
入 123456789 100 21 输出 123456789 2 100 |
|