結果

問題 No.637 X: Yet Another FizzBuzz Problem
ユーザー nali
提出日時 2019-08-04 20:35:00
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 30 ms / 1,000 ms
コード長 406 bytes
コンパイル時間 1,049 ms
コンパイル使用メモリ 109,700 KB
実行使用メモリ 27,516 KB
最終ジャッジ日時 2024-07-16 02:15:03
合計ジャッジ時間 2,939 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 30
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Linq;

class Program {
  static void Main() {
    var arr = Console.ReadLine().Split().Select(int.Parse).ToArray();
    var ans = 0;
    foreach (var n in arr) {
      if (n % 3 == 0 && n % 5 == 0) {
        ans += 8;
      } else if (n % 3 == 0 || n % 5 == 0) {
        ans += 4;
      } else {
        ans += n.ToString().Length;
      }
    }
    Console.WriteLine(ans);
  }
}
0