結果

問題 No.138 化石のバージョン
ユーザー alpha_virginis
提出日時 2015-03-05 20:50:33
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 688 bytes
コンパイル時間 731 ms
コンパイル使用メモリ 65,724 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-29 13:06:03
合計ジャッジ時間 1,797 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:14:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |   scanf("%d.%d.%d", &a0, &b0, &c0);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:15:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   15 |   scanf("%d.%d.%d", &a1, &b1, &c1);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <math.h>

#include <iostream>
#include <vector>
#include <algorithm>

int main() {

  int a0, b0, c0;
  int a1, b1, c1;
  bool y_n;

  scanf("%d.%d.%d", &a0, &b0, &c0);
  scanf("%d.%d.%d", &a1, &b1, &c1);

  if( a0 < a1 ) {
    y_n = false;
  }
  else if( a0 > a1) {
    y_n = true;
  }
  else {

    if( b0 < b1 ) {
      y_n = false;
    }
    else if( b0 > b1) {
      y_n = true;
    }
    else {

      if( c0 < c1 ) {
	y_n = false;
      }
      else if( c0 > c1) {
	y_n = true;
      }
      else {
	y_n = true;
      }

    }

  }

  if( y_n ) {
    std::cout << "YES" << std::endl;
  }
  else {
    std::cout << "NO" << std::endl;
  }

  return 0;
}

0