Submission #3777886


Source Code Expand

import java.util.Scanner;

class Main{

	static	int[] data;




	public static void main(String[] args) {





		Scanner sc = new Scanner(System.in);			//文字の入力
		int k = sc.nextInt();
		int s = sc.nextInt();
		
		int ans = 0;
		for(int a = 0;a <= k;a++){
			for(int b = 0;b <= k;b++){
				int c =  s - (b + a);
				if(c <= k && c >= 0){
					ans++;
				}
			}
		}

		System.out.println(ans);


	}



	static void num(int n){


		int num = n;
		for(int i = 1;i <= n;i++){
			if(n % i == 0){
				data[i]++;
				n /= i;
				i = 1;
			}
		}
		return;

	}
}


class Pair implements Comparable{
	Character from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	}
}


Submission Info

Submission Time
Task B - Sum of Three Integers
User oyr
Language Java8 (OpenJDK 1.8.0)
Score 200
Code Size 810 Byte
Status AC
Exec Time 108 ms
Memory 22996 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 2
AC × 10
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
All sample_01.txt, sample_02.txt, subtask_1_01.txt, subtask_1_02.txt, subtask_1_03.txt, subtask_1_04.txt, subtask_1_05.txt, subtask_1_06.txt, subtask_1_07.txt, subtask_1_08.txt
Case Name Status Exec Time Memory
sample_01.txt AC 98 ms 18900 KB
sample_02.txt AC 95 ms 19924 KB
subtask_1_01.txt AC 107 ms 19412 KB
subtask_1_02.txt AC 99 ms 20564 KB
subtask_1_03.txt AC 104 ms 20564 KB
subtask_1_04.txt AC 101 ms 21716 KB
subtask_1_05.txt AC 94 ms 19156 KB
subtask_1_06.txt AC 98 ms 22996 KB
subtask_1_07.txt AC 108 ms 21204 KB
subtask_1_08.txt AC 98 ms 19796 KB