結果
問題 |
No.207 世界のなんとか
|
ユーザー |
|
提出日時 | 2018-01-23 19:49:21 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 41 ms / 5,000 ms |
コード長 | 1,001 bytes |
コンパイル時間 | 1,518 ms |
コンパイル使用メモリ | 105,216 KB |
実行使用メモリ | 18,944 KB |
最終ジャッジ日時 | 2024-12-26 03:43:58 |
合計ジャッジ時間 | 2,809 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Collections.Generic; using System.Linq; namespace prob207 { class Program { static void Main(string[] args) { long[] a = Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); if ((a[1]-a[0])<0 || (a[1]-a[0]>100)) { Environment.Exit(0); } for (long i = a[0]; i < a[1]+1; i++) { Check(i); } } private static void Check(long i) { long c = i; List<int> b = new List<int>(); while (i>0) { b.Add((int)(i % 10)); i = i / 10; } // 3の倍数かの判定 if (b.Sum() % 3 == 0) { Console.WriteLine(c); } // 3のつく数か else if (b.Contains(3)) { Console.WriteLine(c); } } } }