[
import java.io.*;
import java.util.*;
import java.text.*;
import java.io.*;
import java.math.*;
import java.util.regex.*;
public class Solution
{
static double rounnd(double r)
{
double t=r;
double x = Math.round(t*100);
x=x/100;
t=x;
return t;
}
public static double op(int w,String sent,double t2) throws Exception
{
String left="qwert",right="yuiop";
int lt=1,rt=1,lastturn=0;
double t3=0;
Scanner sc=new Scanner (System.in);
BufferedReader br=new BufferedReader(new InputStreamReader(System.in) );
lt=1;rt=1;lastturn=0;
for(int j = 0; j < sent.length();j ++)
{
left="qwert";right="yuiop";
t2=0;
lt=lastturn==1?lt:1;
rt=lastturn==2?rt:1;
char ch = sent.charAt(j);
if (left.contains(Character.toString(ch))){
t3=t3+(0.2*lt);
lt=lt*2;
lastturn=1;
}
else if (right.contains(Character.toString(ch))){
t3=t3+(0.1*rt);
rt=rt*2;
lastturn=2;
}
}
return t3;
}
public static void main(String args[])throws Exception {
Scanner sc=new Scanner (System.in);
BufferedReader br=new BufferedReader(new InputStreamReader(System.in) );
String left="qwert",right="yuiop";
int lt=1,rt=1,lastturn=0;
double t2[],t3[];
String sent[];
//System.out.println("Enter Numumber Of lines");
int t=sc.nextInt();
int w[]=new int[t];
t2=new double[t];
t3=new double [t];
sent = new String[t];
for(int i=0;i<t;i++){
w[i]=sc.nextInt();
//br.readLine();
sent[i] = br.readLine();
t2[i] = sc.nextDouble();
t3[i]=(0.3*(w[i]-1));
}
for(int i=0;i<t;i++){
String arr[]=sent[i].split(" ");
String c[]=new String[arr.length];
for(int j=0;j<w[i];j++)
c[j]="";
int r=0;
for(int j = 0; j < arr.length ; j ++){
boolean b=false;
for(int k=0;k<arr.length;k++)//were tyui owiq 5.9 qwer yuio qiwo 5.1 type type were type were type 7.5
{
if(c[k].equals(arr[j]))
b=true;
}
if(b)
{
double q=(op(w[i],arr[j],t2[i])/2);
t3[i]=t3[i]+q;
}
else {
double q=op(w[i],arr[j],t2[i]);
t3[i]=t3[i]+q;
}
c[r++]=arr[j];
}
}
for(int i=0;i<t;i++){
t3[i]=rounnd(t3[i]);
String str=String.valueOf((t3[i]));
str=(str.length()-str.indexOf("."))==3?str:str+"0";
System.out.println((t3[i]<t2[i]?"WORK HARDER, "+str:t3[i]==t2[i]?"GOOD, "+str:t3[i]>t2[i]?"GREAT JOB, "+str:""));
}
}
}][1]
https://www.hackerrank.com/contests/iiitv-bitsetgo-18/challenges/can-you-even-type 对于错误,请参见图像代码,是否有问题链接,是否需要帮助,如果程序在bluej idk上完美运行时发生某种异常,那么在网站https://i.stack.imgur.com/AOnc6.png上会发生什么。 IGNORE THE AHEAD TEXT (我不知道要提交的文本 ),我不知道需要输入多少文字才能提交问题,因为我已经提供了所有详细信息。知道我输入的内容。
答案 0 :(得分:0)
根据此处找到的文档:
https://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html#nextDouble()
InputMismatchException-如果下一个令牌与Float不匹配 正则表达式,或超出范围
在这一行中,您尝试使用Scanner
sent[i] = br.readLine();
但是,附带的图片显示提供的输入可以是整数,甚至可以是字符串。似乎您从不检查收到的输入是双精度还是偶数。我建议您为此工作。
此外,由于许多原因,这是极端错误的。请避免这样做:
sent = new String[t];