Submission #432696
Source Code Expand
import java.io.*; import java.util.*; public class Main { public static void main(String[] args){ // TODO 自動生成されたメソッド・スタブ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int A = sc.nextInt(); int B = sc.nextInt(); int now = 0; //east + for(int i=0;i<N;i++){ String muki = sc.next(); int d = sc.nextInt(); if(muki.equals("East")){ if(d>B){ now+=B; }else if(d>A){ now+=d; }else{ now+=A; } }else{ if(d>B){ now-=B; }else if(d>A){ now-=d; }else{ now-=A; } } } if(now==0){ System.out.println(0); } else if(now<0){ System.out.println("West "+(-now)); }else{ System.out.println("East "+now); } } }
Submission Info
Submission Time | |
---|---|
Task | B - 双子とスイカ割り |
User | kou |
Language | Java (OpenJDK 1.7.0) |
Score | 100 |
Code Size | 911 Byte |
Status | AC |
Exec Time | 391 ms |
Memory | 25196 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 100 / 100 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample-01.txt, sample-02.txt, sample-03.txt |
All | 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, sample-01.txt, sample-02.txt, sample-03.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample-01.txt | AC | 353 ms | 23840 KB |
sample-02.txt | AC | 352 ms | 23952 KB |
sample-03.txt | AC | 352 ms | 23952 KB |
test-01.txt | AC | 352 ms | 23876 KB |
test-02.txt | AC | 354 ms | 23940 KB |
test-03.txt | AC | 354 ms | 23956 KB |
test-04.txt | AC | 353 ms | 23972 KB |
test-05.txt | AC | 355 ms | 23940 KB |
test-06.txt | AC | 357 ms | 23896 KB |
test-07.txt | AC | 369 ms | 24504 KB |
test-08.txt | AC | 370 ms | 24464 KB |
test-09.txt | AC | 376 ms | 24696 KB |
test-10.txt | AC | 371 ms | 24668 KB |
test-11.txt | AC | 379 ms | 24904 KB |
test-12.txt | AC | 386 ms | 24764 KB |
test-13.txt | AC | 385 ms | 24836 KB |
test-14.txt | AC | 385 ms | 25196 KB |
test-15.txt | AC | 388 ms | 24812 KB |
test-16.txt | AC | 377 ms | 25124 KB |
test-17.txt | AC | 379 ms | 24780 KB |
test-18.txt | AC | 378 ms | 24720 KB |
test-19.txt | AC | 377 ms | 24988 KB |
test-20.txt | AC | 374 ms | 24820 KB |
test-21.txt | AC | 381 ms | 25148 KB |
test-22.txt | AC | 379 ms | 24832 KB |
test-23.txt | AC | 381 ms | 24736 KB |
test-24.txt | AC | 368 ms | 24808 KB |
test-25.txt | AC | 379 ms | 25168 KB |
test-26.txt | AC | 386 ms | 25152 KB |
test-27.txt | AC | 378 ms | 24804 KB |
test-28.txt | AC | 378 ms | 24748 KB |
test-29.txt | AC | 376 ms | 24980 KB |
test-30.txt | AC | 391 ms | 24808 KB |