結果
| 問題 | No.311 z in FizzBuzzString |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-02-23 17:08:04 |
| 言語 | Java (openjdk 23) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 542 bytes |
| コンパイル時間 | 2,039 ms |
| コンパイル使用メモリ | 76,192 KB |
| 実行使用メモリ | 64,996 KB |
| 最終ジャッジ日時 | 2024-09-24 22:35:45 |
| 合計ジャッジ時間 | 6,069 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 TLE * 1 -- * 3 |
ソースコード
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long n = sc.nextLong();
String temp ="";
long count = 0;
for (int i = 1; i <= n; i++) {
if (i % 3 == 0 && i % 5 ==0) {
temp += "FizzBuzz";
} else if (i % 3 == 0) {
temp += "Fizz";
}else if (i % 5 == 0) {
temp +="Buzz";
}
}
for (int i = 0; i < temp.length(); i++){
if (temp.substring(i , i+1).equals("z")){
count++;
}
}
System.out.println(count);
sc.close();
}
}