結果

問題 No.2352 Sharpened Knife in Fall
ユーザー Paras YadavParas Yadav
提出日時 2023-06-16 23:01:54
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 13,953 bytes
コンパイル時間 3,131 ms
コンパイル使用メモリ 88,696 KB
実行使用メモリ 59,312 KB
最終ジャッジ日時 2024-06-24 16:04:53
合計ジャッジ時間 8,017 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
57,484 KB
testcase_01 AC 51 ms
50,364 KB
testcase_02 WA -
testcase_03 AC 51 ms
50,456 KB
testcase_04 WA -
testcase_05 AC 52 ms
50,036 KB
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

/*
                                          _ _             
                                         | (_)            
  _ __   __ _ _ __ __ _ ___  ___ ___   __| |_ _ __   __ _ 
 | '_ \ / _` | '__/ _` / __|/ __/ _ \ / _` | | '_ \ / _` |
 | |_) | (_| | | | (_| \__ \ (_| (_) | (_| | | | | | (_| |
 | .__/ \__,_|_|  \__,_|___/\___\___/ \__,_|_|_| |_|\__, |
 | |                                                 __/ |
 |_|                                                |___/ 

*/
import java.lang.*;
import java.math.*;
import java.io.*;
import java.util.*;
public class Main{
    private static Reader br;
    private static Writer ot;
    public static void main (String[] args) throws IOException {
        br = new Reader();
        ot = new Writer();
        int t = 1;//br.nextInt();
        pre();
        while(t-- > 0){
            int n = br.nextInt();
            int m = br.nextInt();
            // int k = br.nextInt();
            solve(n, m);

        }
        ot.close();
    }
    static void solve() throws IOException{

    }
    static void solve(int n) throws IOException{
        
    }
    
    static void solve(int n, int m) throws IOException{
        double radius = n;
        double k = m;
        double area = Math.PI * radius * radius;
        area /= (k + 1);
        double low = 1e-12, high = radius - 1e-12;
        while(high - low > 1e-12){
            double mid = (low + high) / 2;
            // mid = 0.2649;
            double segArea = radius * radius * Math.acos((mid) / (radius));
            segArea -= mid * Math.sqrt(2 * radius * (radius -  mid)  - Math.pow(radius - mid, 2));
            // ot.println(low+" "+high+" "+mid+" "+segArea+" "+area);
            if(segArea > area)
                low = mid;
            else
                high = mid;
        }
        double diff = (2 * high) / (k - 1);
        high = -high;
        for(int i = 0; i < k; i++){
            ot.println(high);
            high += diff;
        }
    }
    
    static List<List<Integer>> adj;
    static long mod = (long)(1e9 + 7);

    static void pre() throws IOException {
        
    }

    // Template Functions
    static long exp(long a, long b, long mod){
        long ans = 1;
        while(b > 0){
            if((b & 1) == 1)
                ans = (ans * a) % mod;
            a = (a * a) % mod;
            b >>= 1;
        }
        return ans;
    }
    static boolean isVowel(char c){
        if(c < 'a')
            c += 32;
        return c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u';
    }
    static class DSU{
        int par[], rank[];
        int comp;
        DSU(int n){
            par = new int[n + 1];
            rank = new int[n + 1];
            for(int i = 1; i <= n; i++)
                par[i] = i;
            comp = n;
        }
        void reset(){
            int n = par.length - 1;
            for(int i = 1; i <= n; i++)
                par[i] = 1;
            Arrays.fill(rank, 0);
            comp = n;
        }
        int find(int node){
            if(par[node] == node)
                return node;
            return par[node] = find(par[node]);
        }
        boolean union(int u, int v){
            u = find(u);
            v = find(v);
            if(u == v)
                return false;
            if(rank[u] > rank[v])
                par[v] = u;
            else if(par[v] > rank[u])
                par[u] = v;
            else{
                par[u] = v;
                rank[v]++;
            }
            comp--;
            return true;
        }
    }
}
class Reader {
    private final java.io.InputStream in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private static final long LONG_MAX_TENTHS = 922337203685477580L;
    private static final int LONG_MAX_LAST_DIGIT = 7;
    private static final int LONG_MIN_LAST_DIGIT = 8;

    public Reader(java.io.InputStream in){
        this.in = in;
    }
    public Reader(java.io.File file) throws java.io.FileNotFoundException {
        this(new java.io.BufferedInputStream(new java.io.FileInputStream(file)));
    }
    public Reader(){
        this(System.in);
    }
 
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (java.io.IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { 
        if (hasNextByte()) return buffer[ptr++]; else return -1;
    }
    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }
    public boolean hasNext() {
        while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
        return hasNextByte();
    }
    public String readLine() {
        if (!hasNext()) throw new java.util.NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
 
    public long nextLong() {
        if (!hasNext()) throw new java.util.NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                int digit = b - '0';
                if (n >= LONG_MAX_TENTHS) {
                    if (n == LONG_MAX_TENTHS) {
                        if (minus) {
                            if (digit <= LONG_MIN_LAST_DIGIT) {
                                n = -n * 10 - digit;
                                b = readByte();
                                if (!isPrintableChar(b)) {
                                    return n;
                                } else if (b < '0' || '9' < b) {
                                    throw new NumberFormatException(
                                       
                                    );
                                }
                            }
                        } else {
                            if (digit <= LONG_MAX_LAST_DIGIT) {
                                n = n * 10 + digit;
                                b = readByte();
                                if (!isPrintableChar(b)) {
                                    return n;
                                } else if (b < '0' || '9' < b) {
                                    throw new NumberFormatException(
                                       
                                    );
                                }
                            }
                        }
                    }
                    throw new ArithmeticException(
                        String.format("%s%d%d... overflows long.", minus ? "-" : "", n, digit)
                    );
                }
                n = n * 10 + digit;
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() {
        return Double.parseDouble(readLine());
    }
 
    public long[] nextLongArray(int length){
        long[] array = new long[length];
        for(int i=0; i<length; i++) array[i] = this.nextLong();
        return array;
    }
    public long[] nextLongArray(int length, java.util.function.LongUnaryOperator map){
        long[] array = new long[length];
        for(int i=0; i<length; i++) array[i] = map.applyAsLong(this.nextLong());
        return array;
    }
    public int[] nextIntArray(int length){
        int[] array = new int[length];
        for(int i=0; i<length; i++) array[i] = this.nextInt();
        return array;
    }
    public int[] nextIntArray(int length, java.util.function.IntUnaryOperator map){
        int[] array = new int[length];
        for(int i=0; i<length; i++) array[i] = map.applyAsInt(this.nextInt());
        return array;
    }
    public double[] nextDoubleArray(int length){
        double[] array = new double[length];
        for(int i=0; i<length; i++) array[i] = this.nextDouble();
        return array;
    }
    public double[] nextDoubleArray(int length, java.util.function.DoubleUnaryOperator map){
        double[] array = new double[length];
        for(int i=0; i<length; i++) array[i] = map.applyAsDouble(this.nextDouble());
        return array;
    }
 
    public long[][] nextLongMatrix(int height, int width){
        long[][] mat = new long[height][width];
        for(int h=0; h<height; h++) for(int w=0; w<width; w++){
            mat[h][w] = this.nextLong();
        }
        return mat;
    }
    public int[][] nextIntMatrix(int height, int width){
        int[][] mat = new int[height][width];
        for(int h=0; h<height; h++) for(int w=0; w<width; w++){
            mat[h][w] = this.nextInt();
        }
        return mat;
    }
    public double[][] nextDoubleMatrix(int height, int width){
        double[][] mat = new double[height][width];
        for(int h=0; h<height; h++) for(int w=0; w<width; w++){
            mat[h][w] = this.nextDouble();
        }
        return mat;
    }
 
    public char[][] nextCharMatrix(int height, int width){
        char[][] mat = new char[height][width];
        for(int h=0; h<height; h++){
            String s = this.readLine();
            for(int w=0; w<width; w++){
                mat[h][w] = s.charAt(w);
            }
        }
        return mat;
    }
}
class Writer extends java.io.PrintWriter{
    public Writer(java.io.PrintStream stream){
        super(stream);
    }
    public Writer(java.io.File file) throws java.io.FileNotFoundException{
        super(new java.io.PrintStream(file));
    }
    public Writer(){
        super(System.out);
    }
    
    private static String dtos(double x, int n) {
        StringBuilder sb = new StringBuilder();
        if(x < 0){
            sb.append('-');
            x = -x;
        }
        x += Math.pow(10, -n)/2;
        sb.append((long)x);
        sb.append(".");
        x -= (long)x;
        for(int i = 0;i < n;i++){
            x *= 10;
            sb.append((int)x);
            x -= (int)x;
        }
        return sb.toString();
    }

    @Override
    public void print(float f){
        super.print(dtos(f, 20));
    }
    @Override
    public void println(float f){
        super.println(dtos(f, 20));
    }
    @Override
    public void print(double d){
        super.print(dtos(d, 20));
    }
    @Override
    public void println(double d){
        super.println(dtos(d, 20));
    }
    
    public void printArray(int[] array, String separator){
        int n = array.length;
        if(n==0){
            super.println();
            return;
        }
        for(int i=0; i<n-1; i++){
            super.print(array[i]);
            super.print(separator);
        }
        super.println(array[n-1]);
    }
    public void printArray(int[] array){
        this.printArray(array, " ");
    }
    public void printArray(int[] array, String separator, java.util.function.IntUnaryOperator map){
        int n = array.length;
        if(n==0){
            super.println();
            return;
        }
        for(int i=0; i<n-1; i++){
            super.print(map.applyAsInt(array[i]));
            super.print(separator);
        }
        super.println(map.applyAsInt(array[n-1]));
    }
    public void printArray(int[] array, java.util.function.IntUnaryOperator map){
        this.printArray(array, " ", map);
    }

    public void printArray(long[] array, String separator){
        int n = array.length;
        if(n==0){
            super.println();
            return;
        }
        for(int i=0; i<n-1; i++){
            super.print(array[i]);
            super.print(separator);
        }
        super.println(array[n-1]);
    }
    public void printArray(long[] array){
        this.printArray(array, " ");
    }
    public void printArray(long[] array, String separator, java.util.function.LongUnaryOperator map){
        int n = array.length;
        if(n==0){
            super.println();
            return;
        }
        for(int i=0; i<n-1; i++){
            super.print(map.applyAsLong(array[i]));
            super.print(separator);
        }
        super.println(map.applyAsLong(array[n-1]));
    }
    public void printArray(long[] array, java.util.function.LongUnaryOperator map){
        this.printArray(array, " ", map);
    }
    public <T> void printArray(T[] array, String separator){
        int n = array.length;
        if(n==0){
            super.println();
            return;
        }
        for(int i=0; i<n-1; i++){
            super.print(array[i]);
            super.print(separator);
        }
        super.println(array[n-1]);
    }
    public <T> void printArray(T[] array){
        this.printArray(array, " ");
    }
    public <T> void printArray(T[] array, String separator, java.util.function.UnaryOperator<T> map){
        int n = array.length;
        if(n==0){
            super.println();
            return;
        }
        for(int i=0; i<n-1; i++){
            super.print(map.apply(array[i]));
            super.print(separator);
        }
        super.println(map.apply(array[n-1]));
    }
    public <T> void printArray(T[] array, java.util.function.UnaryOperator<T> map){
        this.printArray(array, " ", map);
    }
}
0