結果

問題 No.207 世界のなんとか
ユーザー oldlevin
提出日時 2020-02-21 05:45:09
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 27 ms / 5,000 ms
コード長 927 bytes
コンパイル時間 1,005 ms
コンパイル使用メモリ 111,812 KB
実行使用メモリ 18,048 KB
最終ジャッジ日時 2024-10-08 19:42:29
合計ジャッジ時間 2,454 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
using System.Collections.Generic;
using static System.Console;

public class hello{
    public static void Main(){

        //yukicoder 
        //A以上B以下の整数のうち、3の倍数および3の付く数を、小さい順に出力
        
        var s = ReadLine().Trim().Split(' ');//.Select(int.Parse).ToArray();
        var a = s[0];  //1≤A≤2,000,000,000
        var b = s[1];
        var na = long.Parse(a);
        var nb = long.Parse(b);
        
        for(long i =na ; i<=nb;i++){
            //3の倍数
            if(i%3==0 ) {
                WriteLine(i); 
                continue;
            }
            
            //char配列に見立て、文字'3'が含まれるか判定
            var str = Convert.ToString(i);
            if(str.Contains('3')){
                WriteLine(i); 
                continue;
            }
        }

    }
}//end hello
0