Solution for CCC '10 J1 - What is n, Daddy? in Java 8


Nov. 6, 2019 1.454736 seconds Java 8
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
         
            Scanner in = new Scanner(System.in);
            int a = in.nextInt();
            int b;
            int c;
            int counter = 0;
            
            c = a;
            b = 0;
            
            
            for(int i = 0; i < (a / 2) + 1; i++){
                
                if(c <= 5 && b <= 5){
                  //  System.out.println(a + " is " + b + " + " + c);
                    counter++;
                }
                
                b++;
                c--;
            }
                        System.out.println(counter);

 
    }
  
    
}

Editorial


No editorial for this problem. :(

Original Problem


You can view the original page for this problem on the DMOJ.