結果

問題 No.163 cAPSlOCK
ユーザー tsunabittsunabit
提出日時 2018-04-08 18:28:49
言語 Java21
(openjdk 21)
結果
AC  
実行時間 124 ms / 5,000 ms
コード長 2,497 bytes
コンパイル時間 3,465 ms
コンパイル使用メモリ 73,900 KB
実行使用メモリ 57,940 KB
最終ジャッジ日時 2023-09-09 03:11:31
合計ジャッジ時間 7,887 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
56,048 KB
testcase_01 AC 121 ms
55,828 KB
testcase_02 AC 119 ms
55,664 KB
testcase_03 AC 121 ms
56,216 KB
testcase_04 AC 121 ms
56,264 KB
testcase_05 AC 118 ms
57,940 KB
testcase_06 AC 119 ms
55,852 KB
testcase_07 AC 120 ms
56,124 KB
testcase_08 AC 120 ms
56,200 KB
testcase_09 AC 121 ms
55,624 KB
testcase_10 AC 120 ms
55,384 KB
testcase_11 AC 120 ms
56,156 KB
testcase_12 AC 119 ms
55,712 KB
testcase_13 AC 120 ms
55,852 KB
testcase_14 AC 120 ms
56,168 KB
testcase_15 AC 122 ms
55,732 KB
testcase_16 AC 124 ms
55,924 KB
testcase_17 AC 119 ms
56,232 KB
testcase_18 AC 117 ms
55,812 KB
testcase_19 AC 119 ms
56,100 KB
testcase_20 AC 117 ms
56,524 KB
testcase_21 AC 118 ms
55,680 KB
testcase_22 AC 121 ms
56,324 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

// 問題文
// Zeldaは、昨日PCにパスワードを設定した。
// 今日、PCを起動したが、昨日入力したパスワードでは入れない事に気づいた。
// よくよく考えてみると、Caps Lock機能がオンのまま気づかずに入力してしまったようだ。
// *として隠されて表示されるため、入力中には気づかなかったらしい。
// パスワードは、大文字・小文字の半角アルファベット52種類のみ使用する。
// Caps Lockは入力するアルファベットが、小文字の入力なら大文字に、大文字の入力なら小文字として入力される機能である。
// 昨日入力したはずのパスワードの文字列が与えられるので
// 誤って設定された「現在の」パスワードを求めてください。
// ***
// 入力
// Sは、小文字または大文字の半角アルファベット52種類からなる文字列が与えられる。
// 1≤|S|≤100
// ***
// 出力
// 誤って設定された現在のパスワードを求めてください。
// 最後に改行してください。

public class No163 {
    public static void main(String[] args) {
        // 標準入力から読み込む際に、Scannerオブジェクトを使う。
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        // System.out.println(str);
        // String[] moji = str.split("");
        char[] c = str.toCharArray();
        String out = "";
        for(int i = 0; i < str.length(); i++){
            // aaa = aaa + c[i];
            if(Character.isUpperCase(c[i])) {
                // System.out.println("A");
                out = out + String.valueOf(c[i]).toLowerCase();
            }else {
                // System.out.println("a");
                out = out + String.valueOf(c[i]).toUpperCase();
            }
        }
        System.out.println(out);
        // System.out.println("aaa = " + aaa);

        //
        // int l = sc.nextInt();
        // int m = sc.nextInt();
        // int n = sc.nextInt();
        // int total = (100 * l) + (25 * m) + n;
        //
        // int sen = total / 1000;
        // total = total - (sen * 1000);
        // int hyaku = total / 100;
        // total = total - (hyaku * 100);
        // int nijugo = total / 25;
        // total = total - (nijugo * 25);
        // int iti = total;
        //
        // System.out.println(hyaku + nijugo + iti);
    }
}
0