蓝桥杯题—BASIC-1闰年判断 BASIC-2 01字串 BASIC-3 字母图形
2017-01-20 22:07
405 查看
BASIC-1闰年判断
######问题描述:C语言代码:
#include <stdio.h> int main(){ int a; scanf("%d",&a); if(a%4==0&&a%100!=0||a%400==0){ printf("yes"); }else{ printf("no"); } return 0; }
java代码:
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); int a = input.nextInt(); if(a%4==0&&a%100!=0||a%400==0){ System.out.println("yes"); }else{ System.out.println("no"); } } }
BASIC-2 01字串
问题描述:C语言代码:
#include <stdio.h> int main(){ for(int i=0;i<2;i++){ for(int j=0;j<2;j++){ for(int a=0;a<2;a++){ for(int b=0;b<2;b++){ for(int c=0;c<2;c++){ printf("%d%d%d%d%d\n",i,j,a,b,c); } } } } } return 0; }
Java代码:
public class Main{ public static void main(String[] args) { for(int i=0;i<2;i++){ for(int j=0;j<2;j++){ for(int a=0;a<2;a++){ for(int b=0;b<2;b++){ for(int c=0;c<2;c++){ System.out.println(i+""+j+""+a+""+b+""+c); } } } } } } }
BASIC-3 字母图形
问题描述:C语言代码:
#include <stdio.h> #include <math.h> int main(){ int i, j, n, m; scanf("%d%d",&n,&m); for(i=1;i<=n;i++){ for(j=1;j<=m;j++){ char ss=(abs(i-j)+'A');//求绝对值 printf("%c",ss); } printf("\n"); } return 0; }
Java代码:
import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(); int m = input.nextInt(); letter(n, m); } static void letter(int n,int m){ char a='A'; for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ char ss=(char)(Math.abs(i-j)+a);//绝对值 System.out.print(ss); } System.out.println(); } } }
相关文章推荐
- 蓝桥杯:基础练习 数列特征、字母图形、01字串、闰年判断
- [蓝桥杯]字母图形+01字串+闰年判断
- BASIC1-4 闰年判断 01字串 字母图形 数列特征
- 蓝桥杯——数列特征,字母图形 , 01字串 ,闰年判断
- 蓝桥杯基础练习之 闰年判断 、 01字串 、查找整数、数列特征 、字母图形
- 蓝桥杯 BASIC_01 基础练习 闰年判断
- 蓝桥杯-基础练习之字母图形——BASIC-3
- 蓝桥杯-字母图形(BASIC)
- 蓝桥杯BASIC-1(闰年判断)
- 蓝桥杯练习题 BASIC-1 闰年判断
- 蓝桥杯 BASIC-1 闰年判断
- 蓝桥杯BASIC-3字母图形
- 蓝桥杯BASIC-3——基础练习 字母图形
- 蓝桥杯 BASIC-1 基础练习 闰年判断
- 蓝桥杯 BASIC-2 01字串 循环
- 蓝桥杯 BASIC-3:字母图形
- 蓝桥杯 BASIC-3 基础练习 字母图形
- 蓝桥杯 BASIC-1 闰年判断 条件判断【闰年的判断】
- Basic_01_闰年判断
- 蓝桥杯练习系统BASIC-1 基础练习 闰年判断