結果

問題 No.163 cAPSlOCK
ユーザー 4A9GN4A9GN
提出日時 2016-07-21 00:25:26
言語 Java21
(openjdk 21)
結果
AC  
実行時間 137 ms / 5,000 ms
コード長 880 bytes
コンパイル時間 2,410 ms
コンパイル使用メモリ 74,628 KB
実行使用メモリ 41,452 KB
最終ジャッジ日時 2024-04-23 19:19:02
合計ジャッジ時間 6,132 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
41,292 KB
testcase_01 AC 124 ms
41,416 KB
testcase_02 AC 129 ms
41,344 KB
testcase_03 AC 137 ms
41,164 KB
testcase_04 AC 124 ms
40,560 KB
testcase_05 AC 124 ms
41,068 KB
testcase_06 AC 125 ms
41,324 KB
testcase_07 AC 118 ms
39,864 KB
testcase_08 AC 134 ms
41,144 KB
testcase_09 AC 132 ms
41,080 KB
testcase_10 AC 131 ms
41,452 KB
testcase_11 AC 128 ms
41,204 KB
testcase_12 AC 132 ms
41,440 KB
testcase_13 AC 118 ms
39,888 KB
testcase_14 AC 135 ms
41,296 KB
testcase_15 AC 132 ms
41,148 KB
testcase_16 AC 134 ms
41,308 KB
testcase_17 AC 122 ms
40,192 KB
testcase_18 AC 117 ms
39,896 KB
testcase_19 AC 113 ms
40,184 KB
testcase_20 AC 129 ms
41,080 KB
testcase_21 AC 111 ms
39,932 KB
testcase_22 AC 124 ms
40,100 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
import java.io.*;
import java.util.ArrayList;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        ArrayList<Character> stoc = new ArrayList<Character>();
        int i = 0;
        for (Character c : str.toCharArray()){
            stoc.add(i, c);
            i++;
        }
        for (i = 0; i < stoc.size(); i++) {
            Character temp = stoc.get(i);
            if (!((Character.toUpperCase(temp)) != stoc.get(i)))
                stoc.set(i, Character.toLowerCase(temp));
            else if (!((Character.toLowerCase(temp)) != stoc.get(i)))
                stoc.set(i, Character.toUpperCase(temp));
        }
        for (i = 0; i < stoc.size(); i++)
            System.out.printf("%c", stoc.get(i));
        System.out.printf("\n");
    }
}
0