結果

問題 No.138 化石のバージョン
ユーザー koyumeishi
提出日時 2015-01-30 16:28:50
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 869 bytes
コンパイル時間 767 ms
コンパイル使用メモリ 76,368 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-23 04:26:19
合計ジャッジ時間 1,708 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27 WA * 6
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:45:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   45 |         scanf("%s.%s.%s", a,b,c);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~
main.cpp:48:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   48 |         scanf("%s.%s.%s", a,b,c);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cstdio>
#include <sstream>
#include <map>
#include <string>
#include <algorithm>
#include <queue>
#include <cmath>
#include <set>
using namespace std;

struct ver{
	string a;
	string b;
	string c;

	ver(char* aa, char* bb, char* cc){
		a = string(aa);
		b = string(bb);
		c = string(cc);
	}

	bool operator==(const ver &x){
		if(a != x.a) return false;
		if(b != x.b) return false;
		if(c != x.c) return false;
		return true;
	}

	bool operator<(const ver &x){
		if(a<x.a) return true;
		else if(a>x.a) return false;
		else if(b<x.b) return true;
		else if(b>x.b) return false;
		else if(c<x.c) return true;
		else return false;
	}

};

int main(){

	char a[10],b[10],c[10];
	scanf("%s.%s.%s", a,b,c);
	ver x(a,b,c);

	scanf("%s.%s.%s", a,b,c);
	ver y(a,b,c);

	cout << ((y<x || y==x) ? "YES":"NO") << endl;

	return 0;
}
0