码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2014-07-23 22:25:47      阅读:269      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   strong   io   

 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

循环-03. 求符合给定条件的整数集,布布扣,bubuko.com

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

标签:style   blog   http   color   strong   io   

原文地址:http://www.cnblogs.com/boomkeeper/p/c3.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!