Submission #3705093


Source Code Expand

import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();

        int answer = 753;

        for (int i = 0; i <= s.length() - 3; i++){
            int number = Integer.parseInt(s.substring(i, i + 3));

            int sabun = Math.abs(number - 753);

            if(sabun - answer < 0){
                answer = sabun;
            }
        }

        System.out.println(answer);


    }

}

Submission Info

Submission Time
Task B - 754
User alkwest
Language Java8 (OpenJDK 1.8.0)
Score 200
Code Size 523 Byte
Status AC
Exec Time 122 ms
Memory 23124 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 10
Set Name Test Cases
Sample a01, a02, a03
All a01, a02, a03, b04, b05, b06, b07, b08, b09, b10
Case Name Status Exec Time Memory
a01 AC 88 ms 18772 KiB
a02 AC 122 ms 19796 KiB
a03 AC 88 ms 18772 KiB
b04 AC 87 ms 21204 KiB
b05 AC 88 ms 20564 KiB
b06 AC 85 ms 18644 KiB
b07 AC 89 ms 23124 KiB
b08 AC 88 ms 22608 KiB
b09 AC 91 ms 19796 KiB
b10 AC 87 ms 21076 KiB