結果

問題 No.138 化石のバージョン
ユーザー kaito_tateyama
提出日時 2017-08-10 13:33:57
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 934 bytes
コンパイル時間 773 ms
コンパイル使用メモリ 69,104 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-29 14:30:31
合計ジャッジ時間 1,814 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <sstream>
using namespace std;

//split(string,区切り文字)
vector<string> split(const string& i, char del) {
    istringstream stream(i);

    string field;
    vector<string> result;
    while (getline(stream, field, del)) {
      result.push_back(field);
    }
    return result;
}

int sp(const string&i, int num){
    int a = stoi(split(i,'.')[num]);
    return a;
}

int main(){

  string m,n;
  cin >> m >> n;
  if (sp(m, 0) > sp(n, 0)) {
    cout << "YES" << "\n";
  }else if (sp(m, 0) < sp(n, 0)) {
    cout << "NO" << "\n";
  }else{
    if (sp(m, 1) > sp(n, 1)) {
      cout << "YES" << "\n";
    }else if (sp(m, 1) < sp(n, 1)) {
      cout << "NO" << "\n";
    }else{
      if (sp(m, 2) >= sp(n, 2)) {
        cout << "YES" << "\n";
      }else if (sp(m, 2) < sp(n, 2)) {
        cout << "NO" << "\n";
      }
    }
  }

  return 0;
}
0