結果
| 問題 | No.536 人工知能 | 
| コンテスト | |
| ユーザー |  くれちー | 
| 提出日時 | 2017-04-04 01:47:34 | 
| 言語 | C#(csc) (csc 3.9.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 27 ms / 1,000 ms | 
| コード長 | 1,211 bytes | 
| コンパイル時間 | 904 ms | 
| コンパイル使用メモリ | 106,752 KB | 
| 実行使用メモリ | 19,840 KB | 
| 最終ジャッジ日時 | 2024-07-08 08:35:08 | 
| 合計ジャッジ時間 | 1,859 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 11 | 
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.IO;
using System.Linq;
class Program
{
    static void Assert(bool expr, string message)
    {
        if (!expr)
        {
            Console.Error.WriteLine("Error: " + message);
            Environment.Exit(1);
        }
    }
    static string GetCheckedInput(string input)
    {
        Assert(input.EndsWith(Environment.NewLine), "No newline");
        var lines = input.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
        Assert(lines.Count() == 2, "Too many inputs");
        Assert(2 <= lines[0].Count(), "|S| < 2");
        Assert(lines[0].Count() <= 10, "|S| > 10");
        Assert(lines[0].All(c => ('a' <= c && c <= 'z')), "Invalid character");
        return lines[0];
    }
    static string Solve(string s)
    {
        var lasts = s.Substring(s.Length - 2);
        if (lasts == "ai") return s.Substring(0, s.Length - 2) + lasts.ToUpper();
        else return s + "-AI";
    }
    static void Main()
    {
        using (var sr = new StreamReader(Console.OpenStandardInput()))
        {
            var rawInput = sr.ReadToEnd();
            var s = GetCheckedInput(rawInput);
            Console.WriteLine(Solve(s));
        }
    }
}
            
            
            
        