結果
問題 |
No.138 化石のバージョン
|
ユーザー |
|
提出日時 | 2018-01-18 15:00:44 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 27 ms / 5,000 ms |
コード長 | 1,248 bytes |
コンパイル時間 | 2,013 ms |
コンパイル使用メモリ | 104,064 KB |
実行使用メモリ | 18,048 KB |
最終ジャッジ日時 | 2024-12-29 14:44:09 |
合計ジャッジ時間 | 2,844 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 33 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Linq; using System.IO; using System.Text; using System.Collections; using System.Collections.Generic; class lecture { public static void Main(string[] args) { //https://yukicoder.me/problems/no/138 // 1.2.3 や 0.0.0などのバージョンの文字が与えられるので比較してください // version2がversion1と同じかより古い場合はYES、 // それ以外はNOを出力してください。 string version1 = Console.ReadLine(); string version2 = Console.ReadLine(); string[] A = version1.Split('.'); int[] ver1 = new int[3]; for (int i = 0; i < 3;i++){ ver1[i] = int.Parse(A[i]); } A = version2.Split('.'); int[] ver2 = new int[3]; for (int i = 0; i < 3; i++) { ver2[i] = int.Parse(A[i]); } for (int i = 0; i < 3;i++){ if (ver1[i] < ver2[i]) { Console.WriteLine("NO"); return; } else if (ver1[i] > ver2[i]) { Console.WriteLine("YES"); return; } } Console.WriteLine("YES"); } }