Submission #1898642
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 a = sc.nextInt(); int b = sc.nextInt(); int sum = 0; for(int i = 1; i <= n; i++) { String str = String.valueOf(i); String strArr[] = str.split(""); int sum1 = 0; for(int j = 0; j < strArr.length; j++) { int intStrArr = Integer.parseInt(strArr[j]); sum1 += intStrArr; } if(a <= sum1 & sum1 <= b) { sum += i; } } System.out.println(sum); } }
Submission Info
Submission Time | |
---|---|
Task | B - Some Sums |
User | nari0shota |
Language | Java8 (OpenJDK 1.8.0) |
Score | 200 |
Code Size | 564 Byte |
Status | AC |
Exec Time | 190 ms |
Memory | 36692 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 | 165 ms | 31316 KB |
02.txt | AC | 154 ms | 22476 KB |
03.txt | AC | 190 ms | 36692 KB |
04.txt | AC | 174 ms | 30804 KB |
05.txt | AC | 172 ms | 28500 KB |
06.txt | AC | 160 ms | 28756 KB |
07.txt | AC | 184 ms | 33620 KB |
08.txt | AC | 157 ms | 30932 KB |
s1.txt | AC | 92 ms | 18512 KB |
s2.txt | AC | 92 ms | 19924 KB |
s3.txt | AC | 96 ms | 18644 KB |