Click here to Skip to main content
14,237,256 members
   

Java

 
AnswerRe: java Pin
Richard MacCutchan2-Nov-18 23:06
protectorRichard MacCutchan2-Nov-18 23:06 
GeneralRe: java Pin
mohit gite4-Nov-18 20:28
membermohit gite4-Nov-18 20:28 
Questionjava Pin
Member 1402833822-Oct-18 4:12
memberMember 1402833822-Oct-18 4:12 
AnswerRe: java Pin
Richard MacCutchan22-Oct-18 5:55
protectorRichard MacCutchan22-Oct-18 5:55 
GeneralRe: java Pin
Member 1402833822-Oct-18 6:56
memberMember 1402833822-Oct-18 6:56 
GeneralRe: java Pin
Richard MacCutchan22-Oct-18 8:42
protectorRichard MacCutchan22-Oct-18 8:42 
GeneralRe: java. Troll Pin
Mycroft Holmes22-Oct-18 13:02
memberMycroft Holmes22-Oct-18 13:02 
QuestionRuntime Error showing NumberFormatException: Kindly solve the error Pin
Member 1402130020-Oct-18 3:07
memberMember 1402130020-Oct-18 3:07 
import java.util.*;
import java.io.*;

class Codechef
{
    public static void main(String[] args) throws Exception
    {
       BufferedReader a=new BufferedReader(new InputStreamReader(System.in));
       int tc=Integer.parseInt(a.readLine());
       Solution s = new Solution();
       for(int i=0;i<tc;i++)
        s.solve();
    }
  
}

class Solution
{
  boolean check(String str,List<String> list)
  {
    if(list.indexOf(str)!=-1)
      return true;
    return false;
  }

  void sum(List<Double> list) 
  {
    Double temp = 0.0;
    for (double i: list)
          temp += i;
    int result=temp.intValue();
    System.out.println(result);
  }
  void solve() throws Exception
  {
    BufferedReader b=new BufferedReader(new InputStreamReader(System.in));
    int n=Integer.parseInt(b.readLine());
    String str;
    double temp;
    int result;
    List<String> wordlist = new ArrayList<String>();
    List<Double> timelist = new ArrayList<Double>();
    for(int k=0;k<n;k++)
    {
      str = b.readLine();
      if(check(str,wordlist))
      {
        int i= wordlist.indexOf(str);
        temp = timelist.get(i);
        temp = temp/2;
        timelist.add(temp); 
      }
      else
      {
        temp = 2;
        for(int i=1;i<str.length();i++)
        {
          if(str.charAt(i)=='d' || str.charAt(i)=='f')
              if(str.charAt(i-1)!='d' && str.charAt(i-1)!='f')
                  temp+=2;
              else
                  temp+=4;
          if(str.charAt(i)=='j' || str.charAt(i)=='k')
              if(str.charAt(i-1)!='j' && str.charAt(i-1)!='k')
                  temp+=2;
              else
                  temp+=4;
        }
        wordlist.add(str);
        timelist.add(temp);        
      }
    }
    sum(timelist);
  }
}

QuestionRe: Runtime Error showing NumberFormatException: Kindly solve the error Pin
Richard MacCutchan20-Oct-18 4:05
protectorRichard MacCutchan20-Oct-18 4:05 
AnswerRe: Runtime Error showing NumberFormatException: Kindly solve the error Pin
Afzaal Ahmad Zeeshan20-Oct-18 4:29
mveAfzaal Ahmad Zeeshan20-Oct-18 4:29 
QuestionFinalize method in java Pin
ashutoshgadgil16-Oct-18 18:16
memberashutoshgadgil16-Oct-18 18:16 
QuestionRe: Finalize method in java Pin
Richard MacCutchan16-Oct-18 21:57
protectorRichard MacCutchan16-Oct-18 21:57 
AnswerRe: Finalize method in java Pin
ashutoshgadgil16-Oct-18 22:29
memberashutoshgadgil16-Oct-18 22:29 
GeneralRe: Finalize method in java Pin
Richard MacCutchan16-Oct-18 23:07
protectorRichard MacCutchan16-Oct-18 23:07 
GeneralRe: Finalize method in java Pin
ashutoshgadgil16-Oct-18 23:11
memberashutoshgadgil16-Oct-18 23:11 
QuestionInspecting java application (Java spy, Java object inspector) - Automation Pin
Member 1383827315-Oct-18 18:58
memberMember 1383827315-Oct-18 18:58 
RantJava, Eclipse, Windowbuilder regarding a homemade Desktop App Pin
nated09913-Oct-18 18:41
membernated09913-Oct-18 18:41 
GeneralRe: Java, Eclipse, Windowbuilder regarding a homemade Desktop App Pin
Richard MacCutchan14-Oct-18 1:35
protectorRichard MacCutchan14-Oct-18 1:35 
GeneralRe: Java, Eclipse, Windowbuilder regarding a homemade Desktop App Pin
#realJSOP5-Nov-18 4:27
mve#realJSOP5-Nov-18 4:27 
GeneralRe: Java, Eclipse, Windowbuilder regarding a homemade Desktop App Pin
nated09927-Dec-18 8:27
membernated09927-Dec-18 8:27 
GeneralRe: Java, Eclipse, Windowbuilder regarding a homemade Desktop App Pin
Mycroft Holmes14-Oct-18 13:12
memberMycroft Holmes14-Oct-18 13:12 
GeneralRe: Java, Eclipse, Windowbuilder regarding a homemade Desktop App Pin
Eddy Vluggen15-Oct-18 0:53
mveEddy Vluggen15-Oct-18 0:53 
GeneralRe: Java, Eclipse, Windowbuilder regarding a homemade Desktop App Pin
#realJSOP5-Nov-18 4:33
mve#realJSOP5-Nov-18 4:33 
QuestionDaemon Thread Pin
ashutoshgadgil11-Oct-18 21:50
memberashutoshgadgil11-Oct-18 21:50 
AnswerRe: Daemon Thread Pin
Richard MacCutchan11-Oct-18 22:34
protectorRichard MacCutchan11-Oct-18 22:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.