Task: | k-mer |
Sender: | PILIPOJAT!! |
Submission time: | 2016-09-27 16:51:02 +0300 |
Language: | Java |
Status: | READY |
Result: | ACCEPTED |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.10 s | details |
#2 | ACCEPTED | 0.12 s | details |
#3 | ACCEPTED | 0.10 s | details |
#4 | ACCEPTED | 0.10 s | details |
#5 | ACCEPTED | 0.10 s | details |
#6 | ACCEPTED | 0.10 s | details |
#7 | ACCEPTED | 0.11 s | details |
#8 | ACCEPTED | 0.11 s | details |
#9 | ACCEPTED | 0.11 s | details |
#10 | ACCEPTED | 0.11 s | details |
#11 | ACCEPTED | 0.10 s | details |
#12 | ACCEPTED | 0.10 s | details |
#13 | ACCEPTED | 0.10 s | details |
#14 | ACCEPTED | 0.10 s | details |
#15 | ACCEPTED | 0.10 s | details |
#16 | ACCEPTED | 0.10 s | details |
#17 | ACCEPTED | 0.10 s | details |
#18 | ACCEPTED | 0.10 s | details |
#19 | ACCEPTED | 0.11 s | details |
#20 | ACCEPTED | 0.10 s | details |
#21 | ACCEPTED | 0.10 s | details |
#22 | ACCEPTED | 0.10 s | details |
#23 | ACCEPTED | 0.11 s | details |
#24 | ACCEPTED | 0.10 s | details |
#25 | ACCEPTED | 0.10 s | details |
#26 | ACCEPTED | 0.10 s | details |
#27 | ACCEPTED | 0.10 s | details |
#28 | ACCEPTED | 0.10 s | details |
#29 | ACCEPTED | 0.10 s | details |
#30 | ACCEPTED | 0.10 s | details |
Code
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import java.util.*; import java.io.*; /** * * @author eamiller */ public class Cses { /** * @param args the command line arguments */ public static void main(String[] args) { IO io = new IO(); int AT = 0; int GC = 0; String input = io.next(); for(int i = 0; i < input.length(); i++){ if(input.charAt(i) == 'A' && input.length()-i >=4){ if(input.substring(i, i+4).equals("ATAT")){ AT++; i++; } } else if(input.charAt(i) == 'G' && input.length()-i >=4) { if(input.substring(i, i+4).equals("GCGC")){ GC++; i++; } } } if(AT > GC){ System.out.println("Kaaleppi"); }else if(GC> AT){ System.out.println("Maija"); }else{ System.out.println("not sure"); } } public static class IO extends PrintWriter { private InputStreamReader r; private static final int BUFSIZE = 1 << 15; private char[] buf; private int bufc; private int bufi; private StringBuilder sb; public IO() { super(new BufferedOutputStream(System.out)); r = new InputStreamReader(System.in); buf = new char[BUFSIZE]; bufc = 0; bufi = 0; sb = new StringBuilder(); } private void fillBuf() throws IOException { bufi = 0; bufc = 0; while(bufc == 0) { bufc = r.read(buf, 0, BUFSIZE); if(bufc == -1) { bufc = 0; return; } } } private boolean pumpBuf() throws IOException { if(bufi == bufc) { fillBuf(); } return bufc != 0; } private boolean isDelimiter(char c) { return c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '\f'; } private void eatDelimiters() throws IOException { while(true) { if(bufi == bufc) { fillBuf(); if(bufc == 0) throw new RuntimeException("IO: Out of input."); } if(!isDelimiter(buf[bufi])) break; ++bufi; } } public String next() { try { sb.setLength(0); eatDelimiters(); int start = bufi; while(true) { if(bufi == bufc) { sb.append(buf, start, bufi - start); fillBuf(); start = 0; if(bufc == 0) break; } if(isDelimiter(buf[bufi])) break; ++bufi; } sb.append(buf, start, bufi - start); return sb.toString(); } catch(IOException e) { throw new RuntimeException("IO.next: Caught IOException."); } } public int nextInt() { try { int ret = 0; eatDelimiters(); boolean positive = true; if(buf[bufi] == '-') { ++bufi; if(!pumpBuf()) throw new RuntimeException("IO.nextInt: Invalid int."); positive = false; } boolean first = true; while(true) { if(!pumpBuf()) break; if(isDelimiter(buf[bufi])) { if(first) throw new RuntimeException("IO.nextInt: Invalid int."); break; } first = false; if(buf[bufi] >= '0' && buf[bufi] <= '9') { if(ret < -214748364) throw new RuntimeException("IO.nextInt: Invalid int."); ret *= 10; ret -= (int)(buf[bufi] - '0'); if(ret > 0) throw new RuntimeException("IO.nextInt: Invalid int."); } else { throw new RuntimeException("IO.nextInt: Invalid int."); } ++bufi; } if(positive) { if(ret == -2147483648) throw new RuntimeException("IO.nextInt: Invalid int."); ret = -ret; } return ret; } catch(IOException e) { throw new RuntimeException("IO.nextInt: Caught IOException."); } } public long nextLong() { try { long ret = 0; eatDelimiters(); boolean positive = true; if(buf[bufi] == '-') { ++bufi; if(!pumpBuf()) throw new RuntimeException("IO.nextLong: Invalid long."); positive = false; } boolean first = true; while(true) { if(!pumpBuf()) break; if(isDelimiter(buf[bufi])) { if(first) throw new RuntimeException("IO.nextLong: Invalid long."); break; } first = false; if(buf[bufi] >= '0' && buf[bufi] <= '9') { if(ret < -922337203685477580L) throw new RuntimeException("IO.nextLong: Invalid long."); ret *= 10; ret -= (long)(buf[bufi] - '0'); if(ret > 0) throw new RuntimeException("IO.nextLong: Invalid long."); } else { throw new RuntimeException("IO.nextLong: Invalid long."); } ++bufi; } if(positive) { if(ret == -9223372036854775808L) throw new RuntimeException("IO.nextLong: Invalid long."); ret = -ret; } return ret; } catch(IOException e) { throw new RuntimeException("IO.nextLong: Caught IOException."); } } public double nextDouble() { return Double.parseDouble(next()); } } }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
CGGCGCAATATGCGCCGCGC |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 2
Verdict: ACCEPTED
input |
---|
TAATATATATGGCGCGCAA |
correct output |
---|
Kaaleppi |
user output |
---|
Kaaleppi |
Test 3
Verdict: ACCEPTED
input |
---|
GCGCGTTAAA |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 4
Verdict: ACCEPTED
input |
---|
CAATCGCGCAATATTGCGC |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 5
Verdict: ACCEPTED
input |
---|
ATATATATGCGCGCGCTAA |
correct output |
---|
not sure |
user output |
---|
not sure |
Test 6
Verdict: ACCEPTED
input |
---|
AATATATATGGCGCGCGC |
correct output |
---|
not sure |
user output |
---|
not sure |
Test 7
Verdict: ACCEPTED
input |
---|
ATATGCGGTT |
correct output |
---|
Kaaleppi |
user output |
---|
Kaaleppi |
Test 8
Verdict: ACCEPTED
input |
---|
TGTTAGCGCGCGTAACATCG |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 9
Verdict: ACCEPTED
input |
---|
GCGCATGAGATATGG |
correct output |
---|
not sure |
user output |
---|
not sure |
Test 10
Verdict: ACCEPTED
input |
---|
ATATGCGCGCGCATATGCGCGCGCATATAT... |
correct output |
---|
Kaaleppi |
user output |
---|
Kaaleppi |
Test 11
Verdict: ACCEPTED
input |
---|
GCGCTATATGCGCGTATATAGCGCCATATC... |
correct output |
---|
Kaaleppi |
user output |
---|
Kaaleppi |
Test 12
Verdict: ACCEPTED
input |
---|
CATATATATCTGGCGCGATATGTTAGCGCG... |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 13
Verdict: ACCEPTED
input |
---|
CCATATACCGCGCTAGCGCCGCGCGCGCGG... |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 14
Verdict: ACCEPTED
input |
---|
ATATGTGGCTGCGCGGCCTGGTAGACGTAT... |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 15
Verdict: ACCEPTED
input |
---|
ATATATATGCGCGCGCATATATATATATAT... |
correct output |
---|
Kaaleppi |
user output |
---|
Kaaleppi |
Test 16
Verdict: ACCEPTED
input |
---|
ATATATATGCGCGCGCATATCTGCGCGCGC... |
correct output |
---|
Kaaleppi |
user output |
---|
Kaaleppi |
Test 17
Verdict: ACCEPTED
input |
---|
ATATATATGATATATATTGCAAATATGCAT... |
correct output |
---|
Kaaleppi |
user output |
---|
Kaaleppi |
Test 18
Verdict: ACCEPTED
input |
---|
TCCGGGCGCTATATGCGCCGCGCCAGTTGA... |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 19
Verdict: ACCEPTED
input |
---|
CATATAGAGCGCTGGACGCAAGTGTCATAT... |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 20
Verdict: ACCEPTED
input |
---|
GCGCGCGCATATGCGCATATGCGCATATGC... |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 21
Verdict: ACCEPTED
input |
---|
CGTAAGCGCATATAGCGCATATGCGCGCGC... |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 22
Verdict: ACCEPTED
input |
---|
TAATATATATATATGCGCGAGCGCGCGCAT... |
correct output |
---|
Kaaleppi |
user output |
---|
Kaaleppi |
Test 23
Verdict: ACCEPTED
input |
---|
GGCGCATATATAACCAGGCGCGCGCATATA... |
correct output |
---|
Kaaleppi |
user output |
---|
Kaaleppi |
Test 24
Verdict: ACCEPTED
input |
---|
CAGACACAAGCGCCGGCGCAGATATGATAT... |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 25
Verdict: ACCEPTED
input |
---|
ATATGCGCGCGCATATATATGCGCGCGCGC... |
correct output |
---|
Kaaleppi |
user output |
---|
Kaaleppi |
Test 26
Verdict: ACCEPTED
input |
---|
AGATATGCGCGCGCATATAGCGCGCGCATA... |
correct output |
---|
Kaaleppi |
user output |
---|
Kaaleppi |
Test 27
Verdict: ACCEPTED
input |
---|
AATATATATCATATTATATTCATATATATT... |
correct output |
---|
Kaaleppi |
user output |
---|
Kaaleppi |
Test 28
Verdict: ACCEPTED
input |
---|
AGCGCGCGCAGGCGCTGTAATATGCGCCCT... |
correct output |
---|
Kaaleppi |
user output |
---|
Kaaleppi |
Test 29
Verdict: ACCEPTED
input |
---|
ACTGCTACGATATCATGGGCGCATATCGCT... |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 30
Verdict: ACCEPTED
input |
---|
GCGCATATATATGCGCATATGCGCGCGCAT... |
correct output |
---|
Maija |
user output |
---|
Maija |