跳到正文

题解

题解 P1085 【不高兴的津津】

半仙胡小桃约 1 分钟
原文
文章信息与版本

文章信息

发布
2018年3月19日
收录
2025年12月12日
更新
2026年11月14日
篇幅
约 1 分钟
获赞
685
题目
P1085

版本

  1. v1当前

这题目在顺序与分支里居然用了For

实在是太不科学了

所以本题的正解是一串if

O(1)复杂度,脚踩STD

C++
#include <iostream>
using namespace std;
int main()
{
	int t1,t2;
	int maxf=/*你觉得应该是多少呢?*/;
	int t=0; //最大量,最大的天数 
	int now=0;//记录现在是哪天 
	cin>>t1>>t2;
    now++; 
	if(t1+t2>maxf) maxf=t1+t2,t=now; 
	cin>>t1>>t2;
    now++; 
	if(t1+t2>maxf) maxf=t1+t2,t=now; 
	cin>>t1>>t2;
    now++; 
	if(t1+t2>maxf) maxf=t1+t2,t=now; 
	cin>>t1>>t2;
    now++; 
	if(t1+t2>maxf) maxf=t1+t2,t=now; 
	cin>>t1>>t2;
    now++; 
	if(t1+t2>maxf) maxf=t1+t2,t=now; 
	cin>>t1>>t2;
    now++; 
	if(t1+t2>maxf) maxf=t1+t2,t=now; 
	cin>>t1>>t2;
    now++; 
	if(t1+t2>maxf) maxf=t1+t2,t=now; 
	cout<<t;
	return 0;
}
原文
存档评论370 条抓取于