Submission #1835197
Source Code Expand
import java.io.*; import java.util.*; class Main { public static void main(String[] args) { MyScanner sc = new MyScanner(); out = new PrintWriter(new BufferedOutputStream(System.out)); double[]p=new double[6],q=new double[6]; for(int i=0;i<6;++i)p[i]=sc.nextDouble()/100.0; for(int i=0;i<6;++i)q[i]=sc.nextDouble()/100.0; double a=0.0,b=1.0; for(int i=0;i<70;++i){ double c=(2.0*a+b)/3.0; double d=(a+2.0*b)/3.0; double fc=0.0,fd=0.0; for(int j=0;j<6;++j){ fc+=Math.max(c*p[j],(1.0-c)*q[j]); fd+=Math.max(d*p[j],(1.0-d)*q[j]); } if(fc>fd) a=c; else b=d; } double o=0.0; for(int i=0;i<6;++i)o+=Math.max(a*p[i],(1.0-a)*q[i]); out.println(o); out.close(); } // http://codeforces.com/blog/entry/7018 //-----------PrintWriter for faster output--------------------------------- public static PrintWriter out; //-----------MyScanner class for faster input---------- public static class MyScanner { BufferedReader br; StringTokenizer st; public MyScanner() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } } return st.nextToken(); } int nextInt() { return Integer.parseInt(next()); } long nextLong() { return Long.parseLong(next()); } double nextDouble() { return Double.parseDouble(next()); } String nextLine(){ String str = ""; try { str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } return str; } } }
Submission Info
Submission Time | |
---|---|
Task | D - Dice Game |
User | kirika_comp |
Language | Java8 (OpenJDK 1.8.0) |
Score | 1000 |
Code Size | 2212 Byte |
Status | AC |
Exec Time | 74 ms |
Memory | 23252 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 1000 / 1000 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | example0.txt, example1.txt |
All | 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, 022.txt, 023.txt, 024.txt, 025.txt, 026.txt, 027.txt, 028.txt, 029.txt, 030.txt, 031.txt, 032.txt, 033.txt, 034.txt, 035.txt, 036.txt, 037.txt, 038.txt, example0.txt, example1.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
000.txt | AC | 73 ms | 23252 KB |
001.txt | AC | 72 ms | 21316 KB |
002.txt | AC | 73 ms | 20180 KB |
003.txt | AC | 74 ms | 22600 KB |
004.txt | AC | 72 ms | 20692 KB |
005.txt | AC | 72 ms | 19924 KB |
006.txt | AC | 70 ms | 19284 KB |
007.txt | AC | 72 ms | 20180 KB |
008.txt | AC | 71 ms | 20420 KB |
009.txt | AC | 73 ms | 19280 KB |
010.txt | AC | 70 ms | 19540 KB |
011.txt | AC | 71 ms | 21204 KB |
012.txt | AC | 72 ms | 21460 KB |
013.txt | AC | 72 ms | 21316 KB |
014.txt | AC | 73 ms | 19524 KB |
015.txt | AC | 73 ms | 18772 KB |
016.txt | AC | 72 ms | 23252 KB |
017.txt | AC | 71 ms | 20436 KB |
018.txt | AC | 71 ms | 18004 KB |
019.txt | AC | 70 ms | 19284 KB |
020.txt | AC | 70 ms | 17620 KB |
021.txt | AC | 71 ms | 17876 KB |
022.txt | AC | 71 ms | 21332 KB |
023.txt | AC | 72 ms | 19796 KB |
024.txt | AC | 71 ms | 19156 KB |
025.txt | AC | 71 ms | 21204 KB |
026.txt | AC | 73 ms | 20820 KB |
027.txt | AC | 71 ms | 15828 KB |
028.txt | AC | 72 ms | 21076 KB |
029.txt | AC | 71 ms | 19284 KB |
030.txt | AC | 72 ms | 21204 KB |
031.txt | AC | 71 ms | 21332 KB |
032.txt | AC | 70 ms | 18516 KB |
033.txt | AC | 72 ms | 19284 KB |
034.txt | AC | 72 ms | 17876 KB |
035.txt | AC | 71 ms | 18260 KB |
036.txt | AC | 71 ms | 21204 KB |
037.txt | AC | 71 ms | 22996 KB |
038.txt | AC | 71 ms | 19284 KB |
example0.txt | AC | 71 ms | 18772 KB |
example1.txt | AC | 74 ms | 21076 KB |