(原创)蓝桥杯比较简单的算法题

蓝桥杯练习系统简单算法题原创代码

(原创)蓝桥杯基础训练(部分)

(蓝桥杯提交请将LanqiaoOne改为Main,不然会报错)
1.来源:入门训练(圆的面积)
确定小数点位数:
DecimalFormat df = new DecimalFormat("#0.0000000");
		System.out.println(df.format(要输出的数));

2.来源:基础训练(数列排序)
import java.util.Arrays;
import java.util.Scanner;

public class LanqiaoOne {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int a[] = new int[n];
		for(int i = 0;i99999)
			{
				int f = i/100000;
				int e1 = i/10000%10;
				int d1 = i/1000%10;
				int c1 = i/100%10;
				int b1 = i/10%10;
				int a1 = i%10;
				if(f == a1&&e1 == b1&&d1 == c1&&f+e1+d1+c1+b1+a1 == shuru)
				{
					System.out.println(i);
				}
			}
		}	
	}
}

7.来源:算法训练(水仙花)
import java.util.Scanner;
public class LanqiaoOne {
	public static void main(String[] args) {		
		Scanner scan = new Scanner(System.in);
		int shuru = scan.nextInt();
		if(shuru>99 && shuru<1000)
		{
			int c = shuru/100;
			int b = shuru/10%10;
			int a = shuru%10;
			if(a*a*a+b*b*b+c*c*c == shuru)
				System.out.println("YES");
			else
				System.out.println("NO");
		}
		else
			System.out.println("NO");	
	}
}

7.来源:算法训练(大等于n的最小完全平方数)
import java.util.Scanner;
public class LanqiaoOne {
	public static void main(String[] args) {	
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		for(int i = 0;in)
			{
				System.out.println(i*i);
				break;
			}
		}	
	}
}

你可能感兴趣的:(笔记)