結果

問題 No.2843 Birthday Present Struggle
コンテスト
ユーザー tenten
提出日時 2024-08-26 13:06:37
言語 Java
(openjdk 25.0.2)
コンパイル:
javac -encoding UTF8 _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true _class_
結果
AC  
実行時間 53 ms / 2,000 ms
コード長 1,860 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,933 ms
コンパイル使用メモリ 93,224 KB
実行使用メモリ 40,172 KB
最終ジャッジ日時 2026-04-03 23:16:47
合計ジャッジ時間 5,325 ms
ジャッジサーバーID
(参考情報)
judge5_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import java.io.*;
import java.util.*;
import java.util.function.*;
import java.util.stream.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        sc.nextInt();
        sc.nextInt();
        sc.nextInt();
        sc.nextInt();
        sc.nextInt();
        Point p = new Point(sc.nextInt(), sc.nextInt());
        List<Point> list = new ArrayList<>();
        list.add(p.add(-1, 0));
        list.add(p.add(1, 0));
        list.add(p.add(0, -1));
        list.add(p.add(0, 1));
        System.out.println(4);
        System.out.println(list.stream().map(x -> x.toString()).collect(Collectors.joining("\n")));
    }
    
    static class Point {
        int x;
        int y;
        
        public Point(int x, int y) {
            this.x = x;
            this.y = y;
        }
        
        public Point add(int a, int b) {
            return new Point(x + a, y + b);
        }
        
        public String toString() {
            return x + " " + y;
        }
    }
}

class Scanner {
    BufferedReader br;
    StringTokenizer st = new StringTokenizer("");

    public Scanner() {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
        } catch (Exception e) {
            
        }
    }
    
    public int nextInt() {
        return Integer.parseInt(next());
    }
    
    public long nextLong() {
        return Long.parseLong(next());
    }
    
    public double nextDouble() {
        return Double.parseDouble(next());
    }
    
    public String next() {
        try {
            while (!st.hasMoreTokens()) {
                st = new StringTokenizer(br.readLine());
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            return st.nextToken();
        }
    }
    
}


0