“Java -Code zum C -Codekonverter online” Code-Antworten

Java -Code zum C -Codekonverter online

import java.util.Scanner;
class CodeChef
{
  public static void(String args[])
  {
    Scanner s=new Scanner;
    int t=s.nextInt();
    for(int i=0;i<t;i++)
    {
      int a=s.nextInt();
      int b=s.nextInt();
      if(a!=0)
      {
        System.out.println(a*b)
      }
      else
      {
        System.out.println(a);
      }
    }
  }
}
Shiny Swiftlet

Java -Code zum C -Codekonverter online

 java.util.HashSet;
import java.util.Scanner;
Shreya Shetty

Java -Code zum C -Codekonverter online

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;

public class Solution {

    public static void main(String[] args) {
        Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int testCases = sc.nextInt();
        int n;
        double b;
        int[] a;
        int count;
        for (int i = 1; i <= testCases; i++) {
            n = sc.nextInt();
            a = new int[n];
            b = sc.nextDouble();
            for (int j = 0; j < n; j++) {
                a[j] = sc.nextInt();
            }
            Arrays.sort(a);
            count = 0;

            for (int j = 0; j < n; j++) {
                b = b - a[j];
                if (b < 0) {
                    break;
                }
                count++;
            }
            System.out.println(String.format("Case #%d :%d", i, count));
        }

    }

}
Muthu Kumar

Java -Code zum C -Codekonverter online

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        String[] ids = new String[n];
        for (int i = 0; i < n; i++) {
            ids[i] = in.next();
        }
    }
}
K CHANDRA SEKHAR KARTHIK

Java -Code zum C -Codekonverter online

static int distinctSubString(string s)
Determined Dotterel

Java -Code zum C -Codekonverter online

import java.util.HashSet;
import java.util.Scanner;

class SerenaFlowers{
    public static void main(String args[])
    {
         Scanner sc = new Scanner(System.in);
         int n = sc.nextInt(); 
         int k = sc.nextInt(); 
         sc.nextLine(); 
         int arr[] = new int[n]; 
         String a[] = sc.nextLine().split(" ");
         HashSet hs = new HashSet<>();
         for(int i =0 ; i < a.length ; i++)
         {
             arr[i] = Integer.parseInt(a[i]); 
             if(i<k)
                 hs.add(arr[i]);
         }
         System.out.println(hs.size());
    }
}
Misty Manx

Java -Code zum C -Codekonverter online

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;

public class Solution {

    public static void main(String[] args) {
        Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int testCases = sc.nextInt();
        int n;
        double b;
        int[] a;
        int count;
        for (int i = 1; i <= testCases; i++) {
            n = sc.nextInt();
            a = new int[n];
            b = sc.nextDouble();
            for (int j = 0; j < n; j++) {
                a[j] = sc.nextInt();
            }
            Arrays.sort(a);
            count = 0;

            for (int j = 0; j < n; j++) {
                b = b - a[j];
                if (b < 0) {
                    break;
                }
                count++;
            }
            System.out.println(String.format("Case #%d :%d", i, count));
        }

    }

}
Muthu Kumar

Java -Code zum C -Codekonverter online

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        String[] ids = new String[n];
        for (int i = 0; i < n; i++) {
            ids[i] = in.next();
        }
    }
}
K CHANDRA SEKHAR KARTHIK

Java -Code zum C -Codekonverter online



import java.util.HashSet;

import java.util.Set;
 
// Java Program to find the total 
// number of distinct years 

public class GFG {
 
// function to find the total 
// number of distinct years 

    static int distinct_year(String str) {

        String str2 = "";
 

        Set<String> uniqueDates = new HashSet<>();
 

        for (int i = 0; i < str.length(); i++) {
 

            if (Character.isDigit(str.charAt(i))) {

                str2 += (str.charAt(i));

            }
 

            // if we found - then clear the str2 

            if (str.charAt(i) == '-') {

                str2 = "";

            }
 

            // if length of str2 becomes 4 

            // then store it in a set 

            if (str2.length() == 4) {

                uniqueDates.add(str2);

                str2 = "";

            }

        }
 

        // return the size of set 

        return uniqueDates.size();

    }
 
// Driver code 

    static public void main(String[] args) {

        String str = "UN was established on 24-10-1945."

                + "India got freedom on 15-08-1947.";
 

        System.out.println(distinct_year(str));

    }
}
LOHITHKUMAR GO

Ähnliche Antworten wie “Java -Code zum C -Codekonverter online”

Fragen ähnlich wie “Java -Code zum C -Codekonverter online”

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen