欢迎来到Cefler的博客
博客主页:那个传说中的man的主页
个人专栏:题目解析
推荐文章:题目大解析(3)
import java.util.Scanner;
public class Main {
static public boolean IsPrime(int n)
{
if(n>1) {
for(int i = 2;i<n;i++)
{
if(n%i==0)
return false;
}
return true;
}
return false;
}
public static void main(String args[]) {
int n,m;
Scanner input = new Scanner(System.in);
n = input.nextInt();
m = input.nextInt();
int[] arr = new int[m-n+1];
//输入数据
int sum = 0,count = 0,i=2;
while(count<m) {
if(IsPrime(i))
count++;
if(IsPrime(i)&&count>=n)
{
sum+=i;
}
++i;
}
System.out.println(sum);
}
}
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
String n = new Scanner(System.in).nextLine();
String[] str = {"ling","yi","er","san","si","wu","liu","qi","ba","jiu"};
for(int i = 0;i<n.length();i++)
{
int index = n.charAt(i) - '0';
if(i==0&&n.charAt(0)=='-')
System.out.print("fu");
else
{
if(i==0)
System.out.print(str[index]);
else
System.out.print(" "+str[index]);
}
}
}
}
真心不喜欢java