标签:ext 取数 parse port for imp 入门 close too
···
import java.util.*;
public class Main{
public static void main(String[] args)
{
Scanner scan=new Scanner(System.in);
int n=0;
while(scan.hasNext())
{
int sum=0,num=0;
String line=scan.nextLine();
n=Integer.parseInt(line);
if(n>=10000&&n<=20000)
{
System.out.println(Integer.toBinaryString(n)+","+Integer.toOctalString(n)+","+Integer.toHexString(n));
}
else
{
char []c=line.toCharArray();
if(n<0) {
for(int i=1;i<line.length();i++)
{
num=c[i]-‘0‘;
sum+=num;
System.out.print(num+" ");
}
}
else
{
for(int i=0;i<line.length();i++)
{
num=c[i]-‘0‘;
sum+=num;
System.out.print(num+" ");
}
}
System.out.println(sum);
}
}
scan.close();
}
}
···
标签:ext 取数 parse port for imp 入门 close too
原文地址:https://www.cnblogs.com/huanghongbe/p/11593580.html