循环-03. 求符合给定条件的整数集

 1 /*
 2  * Main.c
 3  * c3-循环-03. 求符合给定条件的整数集
 4  *  Created on: 2014年7月23日
 5  *      Author: Boomkeeper
 6  *****测试通过*******
 7  */
 8 
 9 #include <stdio.h>
10 
11 void cal(int input){
12     int i,j,k;
13     int count=0;
14 
15     for(i=input;i<=(input+3);i++){
16         for(j=input;j<=(input+3);j++){
17             for(k=input;k<=(input+3);k++){
18                 if((i==j)|(j==k)|(i==k))
19                     continue;
20                 printf("%i%i%i",i,j,k);
21                 if(count==5){
22                     printf("\n");
23                     count=0;
24                 }else{
25                     printf(" ");
26                     count++;
27                 }
28             }
29         }
30     }
31 }
32 
33 int main(){
34     int input=0;
35     scanf("%i",&input);
36     if(input<=0||input>6)
37         return 0;
38     cal(input);
39     return 0;
40 }

题目链接:

http://pat.zju.edu.cn/contests/basic-programming/%E5%BE%AA%E7%8E%AF-03

posted @ 2014-07-23 21:56  Boomkeeper  Views(412)  Comments(0Edit  收藏  举报
最好的流量统计 网站流量计数器