nms

在这里插入代码片

//import java. util. ;
/

public class Main {
public static void main(String[] args) {
Scanner in =new Scanner(System.in);
int k=in.nextInt();
int n=in.nextInt();
long ans=1;
for(int cnt=k;cnt<=n;cnt++)
{
ans*=cnt;
}
System.out.println(“product=”+ans);
}
}
*/
/*public class Main {
public static void main(String[] args) {
Scanner in =new Scanner(System.in);
int m=in.nextInt();
//int n=in.nextInt();
long ans=0;
for(int i=200;i<=m;i++)
{
if(is_Prime(i))
ans+=i;
}
System.out.println(ans);
}
static public boolean is_Prime(int x){
int flag=1;
double max =Math.sqrt(x);
for(int i=2;i<=max;i++)
{
if(x%i==0)
return false;
}
return true;
}

}
*/

/*
public class Main {
public static void main(String[] args) {
Scanner in =new Scanner(System.in);
String s=in.nextLine();
//int k=in.nextInt();
//int n=in.nextInt();
int len=s.length();
int ans=0;
for(int i=0;i {
if(s.charAt(i)<=‘Z’&&s.charAt(i)>=‘A’)
ans++;
if(s.charAt(i)<=‘z’&&s.charAt(i)>=‘a’)
ans++;
}
System.out.println(ans);
}
}
/
/

public class Main {
public static void main(String[] args) {
Scanner in =new Scanner(System.in);
int m=in.nextInt();
//int n=in.nextInt();
long ans=0;
for(int i=200;i<=m;i++)
{
if(is_Prime(i))
ans+=i;
}
System.out.println(ans);
}
static public boolean is_Prime(int i){
if(i%1000){
if(i%400
0)
return true;
else
return false;
}
else
{
if(i%4==0)
return true;
else
return false;
}
}
}
*/

/public class Main {
public static void main(String[] args) {
Scanner in =new Scanner(System.in);
int k=in.nextInt();
long ans=1;
//double max=-1000000000;
//int k=in.nextInt();
//int n=in.nextInt();
//int len=s.length();
//int ans=0;
for(int i=0;i {
int a=in.nextInt();
ans
=a;
//if(a>=max)
//max=a;
}

     System.out.println(ans);
    }
}

*/
/*public class Main {
public static void main(String[] args) {
Scanner in =new Scanner(System.in);
int n=in.nextInt();
long ans=1;

	  int bw,sw,gw;
	  bw=n/100;sw=(n-bw*100)/10;gw=n%10;
	  if(n==+(bw+sw+gw)+bw*bw*bw+sw*sw*sw+gw*gw*gw)
		  System.out.println("yes");
	  else
		  System.out.println("no");
    }
}

/
/

public class Main {
public static void main(String[] args) {
Scanner in =new Scanner(System.in);
int n=in.nextInt();
int b[]=new int[33];
b[0]=0;
b[1]=1;
for(int i=2;i<=32;i++)
b[i]=b[i-1]+b[i-2];
for(int i=0;i {
for(int j=0;j<2*(i);j++)
System.out.printf("%d ",b[j]);

		  System.out.printf("%d\n",b[2*i]);
			  
	  }
	  
	 
  }

}*/

/*
import java.util.;
public class Main {
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
int t=in.nextInt();
int z=f(t);//类内调用方法f
System.out.println(z);
double w=f1(t);
System.out.println(w);
}
//y=f(x)=x
x 整数x(叫形参)
private static int f(int x){
//此处添加代码=
int y=x*x;

//添加代码结束=
return y;
}
//y=f1(x)=xxx 整数x
public static double f1(double x){
return xxx; //返回表达式的值
}
}/
/

import java.util.Scanner;

public class Main {

public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int v1 = sc.nextInt();
	int v2 = sc.nextInt();
	int t = sc.nextInt();
	int s = sc.nextInt();
	int l = sc.nextInt();
	int s1=0,s2=0;//分别表示兔子\乌龟距离起点的距离
	int time = 0;
	while(s1 < l && s2 < l ){
		if(s1 - s2 >= t){//兔子休息
			for(int i=0;i

}/
/

import java.io.IOException;
import java.util.Scanner;

public class Main {
public static void main(String[] args) throws IOException{
Scanner scanner = new Scanner(System.in);
int v1 = scanner.nextInt();//兔子
int v2 = scanner.nextInt();//乌龟
int t = scanner.nextInt();//t米
int s = scanner.nextInt();//s秒
int l = scanner.nextInt();

    int s1 = 0;  
    int s2 = 0;  
    int time = 0;  
    while (s1 < l && s2 < l) 
    {  //刚开始执行的肯定是 以下 注释的这种情况
    /*else 
    {//兔子不停
        time++;  
        s1 += v1 * 1;  
        s2 += v2 * 1;  
    }  */ 

/*
if (s1 - s2 >= t)
{// 兔子停
if ((l - s2) / v2 < s)
{// 乌龟先到达终点
time += (l - s2) / v2;
s2 = l;
}
else
{// 乌龟不能到达终点
time += s;
s2 += v2 * s;
}
}
else
{// 兔子不停
time++;
s1 += v1 * 1;
s2 += v2 * 1;
}
}
if (s1 > s2)
{
System.out.println(“R”);
System.out.println(time);
}
else if (s1 < s2)
{
System.out.println(“T”);
System.out.println(time);
}
else
{
System.out.println(“D”);
System.out.println(time);
}
}
}
*/
import java.util.Scanner;

public class Main {

public static void main(String[] args) {
	// TODO Auto-generated method stub
	Scanner in = new Scanner(System.in);
	while(in.hasNext())
	{
		int n = in.nextInt();
		double sum = 0;
		for(int i = 1;i<=2*n+1;i=i+2)
		{
			sum+=1.0/i;
		}
		System.out.println("Sum is "+sum);
	}
	in.close();
}

}

你可能感兴趣的:(nms)