Submission #73086435
Source Code Expand
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n=sc.nextInt();
int k=sc.nextInt();
int count=0;
for(int i=k;i<=n;i++)
{
int d=i;
int sum=0;
while(d>0)
{
sum+=(d%10);
d/=10;
}
if(sum==k)
{
count++;
}
}
System.out.print(count);
}
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - Digit Sum |
| User | Santhosh_L20 |
| Language | Java24 (OpenJDK 24.0.2) |
| Score | 200 |
| Code Size | 542 Byte |
| Status | AC |
| Exec Time | 74 ms |
| Memory | 40964 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 200 / 200 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | sample_01.txt, sample_02.txt, sample_03.txt |
| All | random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, sample_01.txt, sample_02.txt, sample_03.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| random_01.txt | AC | 66 ms | 40896 KiB |
| random_02.txt | AC | 61 ms | 40812 KiB |
| random_03.txt | AC | 61 ms | 40724 KiB |
| random_04.txt | AC | 66 ms | 40664 KiB |
| random_05.txt | AC | 63 ms | 40512 KiB |
| random_06.txt | AC | 74 ms | 40716 KiB |
| random_07.txt | AC | 72 ms | 40120 KiB |
| random_08.txt | AC | 66 ms | 40608 KiB |
| random_09.txt | AC | 63 ms | 40516 KiB |
| sample_01.txt | AC | 60 ms | 40776 KiB |
| sample_02.txt | AC | 61 ms | 40964 KiB |
| sample_03.txt | AC | 64 ms | 40552 KiB |