Submission #1898633
Source Code Expand
import java.util.Scanner; public class Main{ public static void main(String[] args) { // TODO Auto-generated method stub Scanner scan = new Scanner(System.in); long N = scan.nextLong(); long A = scan.nextLong(); long B = scan.nextLong(); long sum = 0; for (int i = 0; i <= N; i++) { if(!func(i,A,B)){ sum+=i; } } System.out.println(sum); } public static boolean func(long num,long A,long B){ long temp = 0; do { temp += num % 10; num/=10; } while (num != 0); if(temp < A || temp > B){ return true; }else{ return false; } } }
Submission Info
Submission Time | |
---|---|
Task | B - Some Sums |
User | mopanlxy |
Language | Java8 (OpenJDK 1.8.0) |
Score | 200 |
Code Size | 639 Byte |
Status | AC |
Exec Time | 109 ms |
Memory | 21844 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | s1.txt, s2.txt, s3.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, s1.txt, s2.txt, s3.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | AC | 109 ms | 20052 KB |
02.txt | AC | 94 ms | 19924 KB |
03.txt | AC | 95 ms | 21844 KB |
04.txt | AC | 97 ms | 20052 KB |
05.txt | AC | 97 ms | 21716 KB |
06.txt | AC | 95 ms | 19924 KB |
07.txt | AC | 97 ms | 21204 KB |
08.txt | AC | 95 ms | 19412 KB |
s1.txt | AC | 93 ms | 19796 KB |
s2.txt | AC | 93 ms | 19028 KB |
s3.txt | AC | 93 ms | 19156 KB |