Submission #179705


Source Code Expand

import static java.util.Arrays.deepToString;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.MathContext;
 
public class Main {
    private static final boolean isDebug = false;
    
    int N;
    
    static final String[] DIRECTION = {"N", "NNE", "NE", "ENE",
                                          "E", "ESE", "SE", "SSE",
                                          "S", "SSW", "SW", "WSW",
                                          "W", "WNW", "NW", "NNW",
    };
    
    static double[] WIND_POWER = {0.2, 1.5, 3.3, 5.4,
                                    7.9, 10.7, 13.8, 17.1,
                                    20.7, 24.4, 28.4, 32.6
    };
    
    
    public final void Solve() throws Throwable { 
        startTime = System.currentTimeMillis();
        
        int m = readBufInt();
        
        int K = 1000;
 
        String V;
        
        if (m < 0.1 * K) {
            V = "00";
        } else if (m <= 5 * K) {
            int vInt = m / K * 10;
            if (vInt / 10 < 1) {
                V = "0" + vInt;
            } else {
                V = String.valueOf(vInt);
            }
        } else if (m <= 30 * K) {
            int vInt = m / K + 50;
            V = String.valueOf(vInt);
        } else if (m <= 70) {
            int vInt = (m / K - 30) / 5 + 80;
            V = String.valueOf(vInt);
        } else {
            V = "89";
        }
        
        pw.println(V);
    }
    
    
    public final void solve() throws Throwable { 
        startTime = System.currentTimeMillis();
        
        int dis = readBufInt();
        int deg = readBufInt();
        
        BigDecimal wPower = new BigDecimal(deg).divide(new BigDecimal(60), 1, BigDecimal.ROUND_HALF_UP);
        int wIndex = 12;
        for (int i = 0; i < 12; i++) {
            if (wPower.compareTo(new BigDecimal(WIND_POWER[i]).setScale(1, BigDecimal.ROUND_HALF_EVEN ))<= 0) {
                wIndex = i;
                break;
            }
        }

        String Dir = "C";;

        if (wIndex != 0) {
            int range = 36000 / 16;
            int start = range / 2;
            
            int dir = (dis * 10 + start) / range;
            if (dir > 15) dir = 0;
            Dir = DIRECTION[dir];
        }
        
        pw.println(Dir + " " + wIndex);
    }
    
    private static long gcd(long n1, long n2) {
        return (n2 == 0)?n1:gcd(n2, n1%n2);
    }

    private static int gcd(int n1, int n2) {
        return (n2 == 0)?n1:gcd(n2, n1%n2);
    }
    private int brPos = 0;
    private int[] brBuf = null;
    
    private final int readBufInt() throws IOException {
        if (brBuf == null || brBuf.length == brPos) {
            brBuf = readIntArray();
            brPos = 0;
        }
        return brBuf[brPos++];
    }

    private final int readInt() throws IOException {
        return Integer.parseInt(br.readLine());
    }

    private final long readLong() throws IOException {
        return Long.parseLong(br.readLine());
    }

    private final int[] readIntArray() throws IOException {
        String[] s = readStrArray();
        int cnt = s.length;
        int[] out = new int[cnt];
        for (int i = 0; i < cnt; i++) out[i] = Integer.parseInt(s[i]);
        return out;
    }

    private final char[] readCharArray() throws IOException {
        String[] s = readStrArray();
        int cnt = s.length;
        char[] out = new char[cnt];
        for (int i = 0; i < cnt; i++) out[i] = s[i].charAt(0);
        return out;
    }

    private final long[] readLongArray() throws IOException {
        String[] s = readStrArray();
        int cnt = s.length;
        long[] out = new long[cnt];
        for (int i = 0; i < cnt; i++) out[i] = Long.parseLong(s[i]);
        return out;
    }

    private final String[] readStrArray() throws IOException {
        String[] s = br.readLine().split(" ");
        return s;
    }

    static long startTime;
    public static void main(String[] args) {
        Main app = new Main();
        try {
            app.br = new BufferedReader(new InputStreamReader(System.in));
            app.solve();
        } catch(Throwable e) {
            e.printStackTrace();
        } finally {
            try { app.br.close();} catch (Exception igunore) {}
        }
        d(System.currentTimeMillis() - startTime + " ms");
        pw.flush();
        pw.close();
    }

   static final void d(Object ... o) {
       if (isDebug) pw.println(deepToString(o));
   }

   BufferedReader br = null;
   static PrintWriter pw = new PrintWriter(System.out);
}

Submission Info

Submission Time
Task C - 風力観測
User tochukaso
Language Java (OpenJDK 1.7.0)
Score 100
Code Size 4846 Byte
Status AC
Exec Time 427 ms
Memory 21424 KB

Judge Result

Set Name all
Score / Max Score 100 / 100
Status
AC × 66
Set Name Test Cases
all 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 00_sample_04.txt, 00_sample_05.txt, 00_sample_06.txt, 00_sample_07.txt, 00_sample_08.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt, test_31.txt, test_32.txt, test_33.txt, test_34.txt, test_35.txt, test_36.txt, test_37.txt, test_38.txt, test_39.txt, test_40.txt, test_41.txt, test_42.txt, test_43.txt, test_44.txt, test_45.txt, test_46.txt, test_47.txt, test_48.txt, test_49.txt, test_50.txt, test_51.txt, test_52.txt, test_53.txt, test_54.txt, test_55.txt, test_56.txt, test_57.txt, test_58.txt
Case Name Status Exec Time Memory
00_sample_01.txt AC 420 ms 21288 KB
00_sample_02.txt AC 378 ms 21420 KB
00_sample_03.txt AC 378 ms 21292 KB
00_sample_04.txt AC 382 ms 21292 KB
00_sample_05.txt AC 382 ms 21296 KB
00_sample_06.txt AC 383 ms 21424 KB
00_sample_07.txt AC 384 ms 21284 KB
00_sample_08.txt AC 375 ms 21284 KB
test_01.txt AC 382 ms 21292 KB
test_02.txt AC 380 ms 21292 KB
test_03.txt AC 381 ms 21260 KB
test_04.txt AC 399 ms 21416 KB
test_05.txt AC 376 ms 21420 KB
test_06.txt AC 385 ms 21168 KB
test_07.txt AC 384 ms 21280 KB
test_08.txt AC 427 ms 21288 KB
test_09.txt AC 416 ms 21292 KB
test_10.txt AC 420 ms 21292 KB
test_11.txt AC 381 ms 21292 KB
test_12.txt AC 379 ms 21292 KB
test_13.txt AC 389 ms 21292 KB
test_14.txt AC 381 ms 21292 KB
test_15.txt AC 386 ms 21420 KB
test_16.txt AC 376 ms 21292 KB
test_17.txt AC 376 ms 21288 KB
test_18.txt AC 375 ms 21292 KB
test_19.txt AC 386 ms 21420 KB
test_20.txt AC 382 ms 21256 KB
test_21.txt AC 385 ms 21164 KB
test_22.txt AC 387 ms 21276 KB
test_23.txt AC 375 ms 21396 KB
test_24.txt AC 381 ms 21292 KB
test_25.txt AC 374 ms 21288 KB
test_26.txt AC 384 ms 21416 KB
test_27.txt AC 385 ms 21260 KB
test_28.txt AC 381 ms 21284 KB
test_29.txt AC 378 ms 21292 KB
test_30.txt AC 376 ms 21408 KB
test_31.txt AC 379 ms 21288 KB
test_32.txt AC 379 ms 21420 KB
test_33.txt AC 385 ms 21292 KB
test_34.txt AC 376 ms 21292 KB
test_35.txt AC 385 ms 21292 KB
test_36.txt AC 375 ms 21288 KB
test_37.txt AC 381 ms 21292 KB
test_38.txt AC 380 ms 21292 KB
test_39.txt AC 380 ms 21288 KB
test_40.txt AC 384 ms 21292 KB
test_41.txt AC 383 ms 21292 KB
test_42.txt AC 394 ms 21288 KB
test_43.txt AC 380 ms 21420 KB
test_44.txt AC 380 ms 21164 KB
test_45.txt AC 381 ms 21388 KB
test_46.txt AC 373 ms 21296 KB
test_47.txt AC 374 ms 21276 KB
test_48.txt AC 379 ms 21284 KB
test_49.txt AC 381 ms 21280 KB
test_50.txt AC 380 ms 21292 KB
test_51.txt AC 387 ms 21292 KB
test_52.txt AC 377 ms 21420 KB
test_53.txt AC 387 ms 21288 KB
test_54.txt AC 378 ms 21296 KB
test_55.txt AC 379 ms 21292 KB
test_56.txt AC 401 ms 21288 KB
test_57.txt AC 376 ms 21288 KB
test_58.txt AC 385 ms 21284 KB