“Kode java ke konverter kode C online” Kode Jawaban

Kode java ke konverter kode C 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

Kode java ke konverter kode C online

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

Kode java ke konverter kode C 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

Kode java ke konverter kode C 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

Kode java ke konverter kode C online

static int distinctSubString(string s)
Determined Dotterel

Kode java ke konverter kode C 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

Kode java ke konverter kode C 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

Kode java ke konverter kode C 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

Kode java ke konverter kode C 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

Jawaban yang mirip dengan “Kode java ke konverter kode C online”

Pertanyaan yang mirip dengan “Kode java ke konverter kode C online”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya