求教
  • 板块灌水区
  • 楼主mndogdied
  • 当前回复0
  • 已保存回复0
  • 发布时间2024/8/16 21:47
  • 上次更新2024/8/17 09:18:12
查看原帖
求教
1383979
mndogdied楼主2024/8/16 21:47

我自己出的题自己做的数据结果自己原本的代码提交上去才4000分(满分10000分)怎么回事

挂代码(U467600)

#include<bits/stdc++.h>
using namespace std;
//#define int long long
#define con continue
signed main()
{
	int n;
	cin>>n;
	string s,b="",shit;
	if(n==0)//特判
	{
		cout<<"-1"; 
		return 0;
	}
	getline(cin,shit,'\n');//把换行吞掉 
	unsigned long long a=0ull;
	while(n--)
	{
		getline(cin,s,'\n');
		if(s=="Soul fusion") a+=LLONG_MAX;
		if(s=="GERMANY ORTHOPEDICS") a+=300ull;
		if(s=="Together FOREVER") a+=100ull; 
		if(s=="Kiss") a+=50ull;
		if(s=="Love") a+=20ull;
		if(s=="Like") a+=5ull;
		if(s=="Hug") a+=1ull;
		/*特判,当a达到ull上限以后就不能加了,
		ull上限-1距离2^64+1之间有三个数2^64-1,2^64,2^64+1,
		由于这些数与2^64-2(实际没空值的最大值)最大差距=3,小于Like的5,所以只有可能是Hug 
		因为提示中讲过只有第三组数据才可能达到2^64-1,
		在前三个字符串中加和一定会为(2^63-1)+(2^63-1)+==2^64-1
		(这里备注一下,第三个字符串只可能是Hug,因为,即使最终结果是2^64+1,那也只比2^63*2要大4,不可能是Like)
		剩下1~3个字符串则一定全是Hug 
		*/ 
		if(a==ULLONG_MAX)
		{
			if(n==2)
			{
				cout<<"18446744073709551616";//2^64
				return 0;
			} 
			if(n==3)
			{
				cout<<"18446744073709551617";//2^64+1
				return 0;
			} 
			if(n==1)
			{
				cout<<ULLONG_MAX;
				return 0;
			} 
		}
	}
	
	cout<<a-1ull;
    if(a>=297ull&&a<=299ull) cout<<"\nYeYan:Oh,There are people like me who are hovering on the edge of German orthopedics!";
    return 0;
    
}

2024/8/16 21:47
加载中...