結果

問題 No.311 z in FizzBuzzString
ユーザー ちよちゃんちよちゃん
提出日時 2016-05-30 12:37:55
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 713 bytes
コンパイル時間 3,722 ms
コンパイル使用メモリ 75,392 KB
実行使用メモリ 57,768 KB
最終ジャッジ日時 2023-10-25 02:44:40
合計ジャッジ時間 5,274 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;

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

public class Yuki311 {
	
	public static void main(String[] args) {
	
		Scanner scan = new Scanner(System.in);
		int num = scan.nextInt();
		scan.close();
		int ans = 0;
		ArrayList<String> arrayList = new ArrayList<String>();
		for (int i = 0; i < num; i++ ) {
			
			if( i%3 == 0 && i%5 == 0 ){
				arrayList.add("FizzBuzz");
			} else if ( i%3 == 0 ) {
				arrayList.add("Fizz");
			} else if ( i%5 == 0 ) {
				arrayList.add("Buzz");
			} else {
				
			}
		}
		
		for(String char_z : arrayList ) {
			for(int i = 0; i < char_z.length(); i++){
				if('z' == char_z.charAt(i)){
					ans++;
				}
			}
		}
		System.out.println(ans);
	}
}
0