标签:ble valueof white 题目 第三版 sys code void big
import java.util.*;
import java.io.*;
import java.math.BigInteger;
public class Main
{
public static void main(String args[])
{
Scanner cin=new Scanner(System.in);
int x=cin.nextInt(),ans=0;
int[] thres={100000,100000,200000,200000,400000};
double[] rate={0.1, 0.075, 0.05, 0.03, 0.015};
for(int i=0;i!=5;++i)
{
if(x<thres[i])
{
ans+=x*rate[i]; x=0; break;
}
else
{
ans+=thres[i]*rate[i]; x-=thres[i];
}
if(x<=0) break;
}
if(x>=0) ans+=x*0.01;
System.out.println(ans);
}
}
import java.util.*;
import java.io.*;
import java.math.BigInteger;
public class Main
{
static int gcd(int x,int y)
{
if(y==0) return x;
else return gcd(y,x%y);
}
static int lcm(int x, int y)
{
return x/gcd(x,y)*y;
}
public static void main(String args[])
{
Scanner cin=new Scanner(System.in);
int n=cin.nextInt(),m=cin.nextInt();
System.out.println(String.valueOf(gcd(n,m))+" "+String.valueOf(lcm(n,m)));
}
}
import java.util.*;
import java.io.*;
import java.math.BigInteger;
import java.lang.Character;
public class Main
{
public static void main(String args[])
{
Scanner cin=new Scanner(System.in);
String str=cin.nextLine();
int l=0, n=0, s=0, o=0;
for(int i=0; i!=str.length(); ++i)
{
char chr=str.charAt(i);
if(Character.isLetter(chr))
{
l++;
}
else if(Character.isDigit(chr))
n++;
else if(Character.isWhitespace(chr))
s++;
else o++;
}
System.out.printf("%d %d %d %d\n",l,n,s,o);
}
}
import java.util.*;
import java.io.*;
import java.math.BigInteger;
import java.lang.Character;
public class Main
{
public static void main(String args[])
{
Scanner cin=new Scanner(System.in);
int n=cin.nextInt();
int x=2;
long sum=0;
for(int i=1;i<=n;++i)
{
sum+=x;
x=x*10+2;
}
System.out.println(sum);
}
}
注意数据范围。java的long
相当于c++的long long
。
import java.util.*;
import java.io.*;
import java.math.BigInteger;
import java.lang.Character;
public class Main
{
public static void main(String args[])
{
Scanner cin=new Scanner(System.in);
int n=cin.nextInt();
long x=1,sum=0;
for(int i=1;i<=n;++i)
{
x*=(long)i;
sum+=x;
}
System.out.println(sum);
}
}
标签:ble valueof white 题目 第三版 sys code void big
原文地址:https://www.cnblogs.com/samhx/p/9739306.html