結果

問題 No.163 cAPSlOCK
ユーザー show258show258
提出日時 2017-04-01 01:49:15
言語 Java19
(openjdk 21)
結果
AC  
実行時間 120 ms / 5,000 ms
コード長 1,004 bytes
コンパイル時間 5,751 ms
コンパイル使用メモリ 72,244 KB
実行使用メモリ 56,388 KB
最終ジャッジ日時 2023-09-21 21:53:34
合計ジャッジ時間 8,557 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 114 ms
55,652 KB
testcase_01 AC 115 ms
55,676 KB
testcase_02 AC 113 ms
55,716 KB
testcase_03 AC 120 ms
55,972 KB
testcase_04 AC 119 ms
56,164 KB
testcase_05 AC 116 ms
55,816 KB
testcase_06 AC 114 ms
55,460 KB
testcase_07 AC 118 ms
55,924 KB
testcase_08 AC 120 ms
55,684 KB
testcase_09 AC 117 ms
55,620 KB
testcase_10 AC 115 ms
56,020 KB
testcase_11 AC 113 ms
55,416 KB
testcase_12 AC 118 ms
56,388 KB
testcase_13 AC 116 ms
55,368 KB
testcase_14 AC 116 ms
55,636 KB
testcase_15 AC 115 ms
56,008 KB
testcase_16 AC 117 ms
55,740 KB
testcase_17 AC 114 ms
55,784 KB
testcase_18 AC 111 ms
55,952 KB
testcase_19 AC 111 ms
56,036 KB
testcase_20 AC 111 ms
55,584 KB
testcase_21 AC 110 ms
55,836 KB
testcase_22 AC 117 ms
55,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No163 {

  public static void main(String[] args) {

    // 標準入力から読み込む際に、Scannerオブジェクトを使う。
    Scanner sc = new Scanner(System.in);

    // String もとの文字列を読み込む
    String str_org = sc.next();

    sc.close(); // 標準入力をクローズ

    char[] charArray = new char[str_org.length()];  //最終結果を格納する場所

    for (int i = 0; i < str_org.length() ; i++ ){

      if ( Character.isLowerCase(str_org.charAt(i)) ) //小文字だったら大文字に変換してlistに格納
      charArray[i] = Character.toUpperCase(str_org.charAt(i));
      else                                  //大文字だったら小文字に変換してlistに格納
      charArray[i] = Character.toLowerCase(str_org.charAt(i));
    }

    // 標準出力に書き出す。
    for (int i = 0; i < str_org.length() ; i++){
      System.out.print(charArray[i]);
    }
    System.out.println();
  }
}
0