AtCoder Beginner Contest 003

Submission #146175

Source codeソースコード

import java.util.ArrayList;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
        String T = sc.nextLine();

        ArrayList<String> str;
        str = new ArrayList<>();

        str.add("a");
        str.add("t");
        str.add("c");
        str.add("o");
        str.add("d");
        str.add("e");
        str.add("r");

        int length = S.length();
        String judge = "a";

        for (int i = 0; i <= length - 1; i++) {
            if ("@".equals(T.substring(i, i + 1)) || "@".equals(S.substring(i, i + 1)) || (S.charAt(i) == T.charAt(i))) {
                if (str.contains(S.substring(i, i + 1))) {
                    judge = "You can win";
                } else if (str.contains(T.substring(i, i + 1))) {
                    judge = "You can win";

                } else if ((S.charAt(i) == T.charAt(i))) {
                    judge = "You can win";

                } else {
                    judge = "You will lose";
                    break;
                }
            } else {
                judge = "You will lose";
                break;
            }

        }
        System.out.println(judge);

    }
}

Submission

Task問題 B - AtCoderトランプ
User nameユーザ名 Dahlia*
Created time投稿日時
Language言語 Java (OpenJDK 1.7.0)
Status状態 AC
Score得点 100
Source lengthソースコード長 1319 Byte
File nameファイル名
Exec time実行時間 589 ms
Memory usageメモリ使用量 24164 KB

Test case

Set

Set name Score得点 / Max score Cases
All 100 / 100 00_sample_01.txt,00_sample_02.txt,00_sample_03.txt,test_AAAAAAAAAA_AAAAAAAAAA.txt,test_AAAAAAA_atcoder.txt,test_AAAAAAAcAA_dddddddddd.txt,test_AAA_AAA.txt,test_AAApqAAq_AmAbAAAv.txt,test_A_A.txt,test_A_z.txt,test_Aataodfoad_cazgodeowA.txt,test_AbAAkAtAAA_AbAAkAAAAc.txt,test_AddAAdAccc_cdddAApcAc.txt,test_AeAApAAkAA_AAAApetkAA.txt,test_AeaewrAckd_teaAwrackd.txt,test_AjuAAfw_AjutAfw.txt,test_AkaAAbhbrA_AayAgbrnno.txt,test_Amk_AiA.txt,test_Aqgzjukogn_vqgzjukogn.txt,test_AtAjjlAlj_zxojqerlj.txt,test_aAAAnoAAAA_AAAAnAAAtA.txt,test_aAsAzpurej_AasAzppAej.txt,test_aaaaaaaaaa_tttttttttt.txt,test_acAtasfAtr_acrtasfrtr.txt,test_aercbrAkAc_aeAcbArkAc.txt,test_aeyfyeu_aeyfyAn.txt,test_akAoazoAgA_ardoazoago.txt,test_alqinmkpob_alqizmvprb.txt,test_atgvrdnadg_atgvrdnadg.txt,test_bAozuxujyf_btAzuxujyf.txt,test_beAdgbAvpm_beoAvbAvpm.txt,test_cejeesaetk_cwecdetuvd.txt,test_cnrrdorw_cnrrdArw.txt,test_coaeeccedr_coaeeccedr.txt,test_cogxtrmwlv_cojxzhuyjv.txt,test_cyhn_AyhA.txt,test_dkaykjA_dkaeAjl.txt,test_dtjwlyycmb_zveetyyqmb.txt,test_dxjunaaqfj_dxjurackej.txt,test_eAhatnjhws_uAAAAnoAfs.txt,test_e_r.txt,test_f_k.txt,test_fq_xv.txt,test_gAuuAzhzAf_kiuwszAzAf.txt,test_gaAAAAAAcA_oAAloAmAAm.txt,test_gxghqm_gxghqm.txt,test_humnAvnlbi_humnAvnlbi.txt,test_hzlsl_ozlsl.txt,test_ifiiAAAjnr_ifiirtAjnr.txt,test_ifwmypbnsy_ifwmypbnsy.txt,test_jhxjiskyyf_uqvmsjtptm.txt,test_khinAAAwAf_khinAAAwrf.txt,test_kodtcdckd_kAdtcdckd.txt,test_lkhxgf_xghwgf.txt,test_ltoh_lAoh.txt,test_moeooAtAAt_mAeooAtAdt.txt,test_nbAAqAnga_nlaAqAngA.txt,test_o_o.txt,test_oderoderod_AAoderAAAd.txt,test_ok_Ak.txt,test_pAknA_pAknA.txt,test_p_A.txt,test_ppxAslAquh_ppxAslAquh.txt,test_qcnnrt_ccnnrA.txt,test_tjAmwowdhk_AjeiwAwdhk.txt,test_uAkAs_tlxas.txt,test_u_u.txt,test_ug_ug.txt,test_vAb_vAA.txt,test_vvgxtupvbt_vvgbtupnbp.txt,test_vvvvvvvvvv_vvvvvvvvvv.txt,test_wAAA_AAAA.txt,test_waAqrnAkka_waoqAnAAkA.txt,test_wokclAAA_wAkAqrAd.txt,test_xkhqxlzkzs_xkhqxlzkzs.txt,test_z_z.txt,test_zctrfqAsAn_zAyrgqtsdn.txt,test_zzsxnmjzfn_zzsxnmjzfn.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
00_sample_01.txt AC 508 ms 24036 KB
00_sample_02.txt AC 459 ms 24020 KB
00_sample_03.txt AC 456 ms 24036 KB
test_AAAAAAAAAA_AAAAAAAAAA.txt AC 461 ms 24032 KB
test_AAAAAAA_atcoder.txt AC 459 ms 23904 KB
test_AAAAAAAcAA_dddddddddd.txt AC 459 ms 24040 KB
test_AAA_AAA.txt AC 457 ms 24032 KB
test_AAApqAAq_AmAbAAAv.txt AC 462 ms 24020 KB
test_A_A.txt AC 467 ms 24032 KB
test_A_z.txt AC 456 ms 23904 KB
test_Aataodfoad_cazgodeowA.txt AC 469 ms 23908 KB
test_AbAAkAtAAA_AbAAkAAAAc.txt AC 467 ms 24032 KB
test_AddAAdAccc_cdddAApcAc.txt AC 473 ms 24108 KB
test_AeAApAAkAA_AAAApetkAA.txt AC 477 ms 24028 KB
test_AeaewrAckd_teaAwrackd.txt AC 505 ms 24036 KB
test_AjuAAfw_AjutAfw.txt AC 484 ms 24040 KB
test_AkaAAbhbrA_AayAgbrnno.txt AC 474 ms 24032 KB
test_Amk_AiA.txt AC 475 ms 24032 KB
test_Aqgzjukogn_vqgzjukogn.txt AC 475 ms 24164 KB
test_AtAjjlAlj_zxojqerlj.txt AC 475 ms 24032 KB
test_aAAAnoAAAA_AAAAnAAAtA.txt AC 486 ms 24032 KB
test_aAsAzpurej_AasAzppAej.txt AC 473 ms 24032 KB
test_aaaaaaaaaa_tttttttttt.txt AC 479 ms 24032 KB
test_acAtasfAtr_acrtasfrtr.txt AC 482 ms 24040 KB
test_aercbrAkAc_aeAcbArkAc.txt AC 484 ms 24040 KB
test_aeyfyeu_aeyfyAn.txt AC 492 ms 24036 KB
test_akAoazoAgA_ardoazoago.txt AC 497 ms 24032 KB
test_alqinmkpob_alqizmvprb.txt AC 489 ms 24028 KB
test_atgvrdnadg_atgvrdnadg.txt AC 476 ms 23980 KB
test_bAozuxujyf_btAzuxujyf.txt AC 479 ms 23904 KB
test_beAdgbAvpm_beoAvbAvpm.txt AC 473 ms 24032 KB
test_cejeesaetk_cwecdetuvd.txt AC 483 ms 24036 KB
test_cnrrdorw_cnrrdArw.txt AC 472 ms 24044 KB
test_coaeeccedr_coaeeccedr.txt AC 474 ms 24028 KB
test_cogxtrmwlv_cojxzhuyjv.txt AC 481 ms 24032 KB
test_cyhn_AyhA.txt AC 472 ms 24040 KB
test_dkaykjA_dkaeAjl.txt AC 464 ms 24028 KB
test_dtjwlyycmb_zveetyyqmb.txt AC 524 ms 24048 KB
test_dxjunaaqfj_dxjurackej.txt AC 484 ms 24036 KB
test_eAhatnjhws_uAAAAnoAfs.txt AC 472 ms 24128 KB
test_e_r.txt AC 470 ms 24028 KB
test_f_k.txt AC 491 ms 24156 KB
test_fq_xv.txt AC 470 ms 24044 KB
test_gAuuAzhzAf_kiuwszAzAf.txt AC 477 ms 24036 KB
test_gaAAAAAAcA_oAAloAmAAm.txt AC 459 ms 24156 KB
test_gxghqm_gxghqm.txt AC 467 ms 24028 KB
test_humnAvnlbi_humnAvnlbi.txt AC 589 ms 24032 KB
test_hzlsl_ozlsl.txt AC 476 ms 24028 KB
test_ifiiAAAjnr_ifiirtAjnr.txt AC 474 ms 24040 KB
test_ifwmypbnsy_ifwmypbnsy.txt AC 475 ms 23948 KB
test_jhxjiskyyf_uqvmsjtptm.txt AC 482 ms 24012 KB
test_khinAAAwAf_khinAAAwrf.txt AC 467 ms 23896 KB
test_kodtcdckd_kAdtcdckd.txt AC 473 ms 24032 KB
test_lkhxgf_xghwgf.txt AC 484 ms 24036 KB
test_ltoh_lAoh.txt AC 476 ms 23980 KB
test_moeooAtAAt_mAeooAtAdt.txt AC 474 ms 24032 KB
test_nbAAqAnga_nlaAqAngA.txt AC 481 ms 24016 KB
test_o_o.txt AC 474 ms 24024 KB
test_oderoderod_AAoderAAAd.txt AC 481 ms 24112 KB
test_ok_Ak.txt AC 480 ms 23912 KB
test_pAknA_pAknA.txt AC 481 ms 24032 KB
test_p_A.txt AC 485 ms 24164 KB
test_ppxAslAquh_ppxAslAquh.txt AC 478 ms 24032 KB
test_qcnnrt_ccnnrA.txt AC 469 ms 23972 KB
test_tjAmwowdhk_AjeiwAwdhk.txt AC 473 ms 24160 KB
test_uAkAs_tlxas.txt AC 475 ms 24068 KB
test_u_u.txt AC 469 ms 24028 KB
test_ug_ug.txt AC 472 ms 24052 KB
test_vAb_vAA.txt AC 471 ms 23904 KB
test_vvgxtupvbt_vvgbtupnbp.txt AC 468 ms 24028 KB
test_vvvvvvvvvv_vvvvvvvvvv.txt AC 476 ms 24020 KB
test_wAAA_AAAA.txt AC 469 ms 24032 KB
test_waAqrnAkka_waoqAnAAkA.txt AC 468 ms 24032 KB
test_wokclAAA_wAkAqrAd.txt AC 465 ms 24040 KB
test_xkhqxlzkzs_xkhqxlzkzs.txt AC 470 ms 23980 KB
test_z_z.txt AC 467 ms 24148 KB
test_zctrfqAsAn_zAyrgqtsdn.txt AC 466 ms 24028 KB
test_zzsxnmjzfn_zzsxnmjzfn.txt AC 481 ms 24028 KB