A. Who is Older?

本文介绍了一个简单的程序,用于比较两个人的出生日期以确定谁更年长。输入为多个测试案例,每个案例包含两个日期,分别代表两个人的生日。程序将根据这些日期判断并输出谁更年长,如果生日相同则输出'same'。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

A. Who is Older?

Time Limit:   1000ms
Memory Limit:   32768KB
64-bit integer IO format:   %lld       Java class name:   Main

Javaman and cpcs are arguing who is older. Write a program to help them.

Input

There are multiple test cases. The first line of input is an integer T (0 < T <= 1000) indicating the number of test cases. Then T test cases follow. The i-th line of the next T lines contains two dates, the birthday of javaman and the birthday of cpcs. The format of the date is "yyyy mm dd". You may assume the birthdays are both valid.

Output

For each test case, output who is older in a single line. If they have the same birthday, output "same" (without quotes) instead.

Sample Input

3
1983 06 06 1984 05 02
1983 05 07 1980 02 29
1991 01 01 1991 01 01

Sample Output

javaman
cpcs
same
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
using namespace std;
char map[2000][2000];
void dfs(int x, int y)
{
	if (map[x][y] == '.')
		return;
	map[x][y] = '.';
	dfs(x + 1, y);
	dfs(x - 1, y);
	dfs(x  , y+1);
	dfs(x , y-1);
	dfs(x+1, y + 1);
	dfs(x-1, y - 1);
	dfs(x+1, y - 1);
	dfs(x-1, y +1);
}
int main()
{
	int t;
	while (cin>>t)
	{
		while (t--)
		{
			int a, b, c, a1, b1, c1;
			cin >> a >> b >> c >> a1 >> b1 >> c1;
			if (a > a1 || (a == a1&&b > b1) || (a == a1&&b == b1&&c > c1))
				puts("cpcs");
			else if (a1 > a || (a == a1&&b < b1) || (a == a1&&b == b1&&c < c1))
				puts("javaman");
			else if (a == a1&&b == b1&&c == c1)
				puts("same");
		}
	}
	return 0;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值