Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static boolean doStuff(int nickels, int pennies, int sum){
- //your code here
- boolean answer = false;
- int n = sum/5;
- // System.out.println(n);
- int p = sum - n*5;
- // System.out.println(p);
- if(n<=nickels && p<=pennies){
- answer = true;
- }
- else answer = false;
- return answer;
- }
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- int n = in.nextInt();
- for(int i=0; i<n; i++){
- int a = in.nextInt();
- int b= in.nextInt();
- int c = in.nextInt();
- System.out.println( doStuff(a, b, c) );
- }
- }
- }
Add Comment
Please, Sign In to add comment