0_0_31907979_27806\Main.java:1: 错误: 类P2031是公共的, 应在名为 P2031.java 的文件中声明
import java.util.Scanner;public class P2031 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); while(sc.hasNext()){ int n=sc.nextInt(); int r=sc.nextInt(); char a[]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; if(r<2&&r>16){ break; } int p=0; if(n<0){ n=-n; p=-1; } int x,y,i=0; String str[]=new String[100]; while(n>0){ x=n%r; str[i]=a[x]+""; i++; n=n/r; } if(p==-1){ System.out.print("-"); } for(int j=i-1;j>=0;j--){ System.out.print(str[j]); } System.out.println(); } }}
^
1 个错误
|