 # ACTNBM – Editorial

Author: Arkapravo Ghosh
Tester: Aparup Ghosh
Editorialist: Aparup Ghosh

CAKEWALK

### PREREQUISITES:

Basic programming, conditionals

### PROBLEM:

Given two integers S and H you need to output “Shinchan” if S > H or “Himawari” otherwise.

### QUICK EXPLANATION:

According to the given conditions, Shinchan can only win when S is greater than H. In any other case, Himawari is the winner.

### EXPLANATION:

We can simply check if S is greater than H or not. If S > H, then we output “Shinchan”(without quotes) else (i.e. when S <= H), we output “Himawari”(without quotes).
The time complexity is O(T).

### AUTHOR’S AND EDITORIALIST’S SOLUTIONS:

Author’s solution can be found here.
Editorialist’s solution can be found here.

2 Likes

#include<stdio.h>
void main()
{
int s,h;
printf("\n Enter the two no= “);
scanf(”%d%d",&s,&h);
printf("\n S=%d",s,"\n H=%d",h);
if(s>h)
{
printf("\n Sinchan");
}
else
{
printf("\n Himawari");
}
}

```for _ in range(int(input())):
S, H = [int(x) for x in input().split()]
print(["Himawari","Shinchan"][S>H])
```

Why does it show TLE for Java Solution?
Is this problem not compatible with Java due to the time constraints set in the question?

I have tried both ways and there’s nothing time-consuming code.

Method 1: Using Scanner
import java.util.;
import java.lang.
;
import java.io.*;

``````class Codechef
{
public static void main (String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-- > 0){
int a = sc.nextInt();
int b = sc.nextInt();
if(a > b)
System.out.println("Shinchan");
else
System.out.println("Himawari");
}
}
}
``````

import java.util.;
import java.lang.
;
import java.io.*;
import java.io.IOException;

``````class Codechef
{
public static void main (String[] args) throws IOException {