/ Randle /

记录详情

Time Exceeded

/in/foo.cc: In function 'int main()':
/in/foo.cc:4:28: warning: unused variable 's' [-Wunused-variable]
  long long n,m,restn,restm,s,ansn=0,ansm=0;
                            ^
# 状态 耗时 内存占用
#1 Time Exceeded ≥1007ms ≥320.0 KiB
#2 Time Exceeded ≥1007ms ≥312.0 KiB
#3 Time Exceeded ≥1007ms ≥312.0 KiB
#4 Time Exceeded ≥1007ms ≥316.0 KiB
#5 Time Exceeded ≥1007ms ≥316.0 KiB
#6 Time Exceeded ≥1006ms ≥304.0 KiB
#7 Wrong Answer 1ms 320.0 KiB
#8 Wrong Answer 3ms 312.0 KiB
#9 Time Exceeded ≥1007ms ≥320.0 KiB
#10 Time Exceeded ≥1002ms ≥316.0 KiB

代码

#include<bits/stdc++.h>
int main()
{
	long long n,m,restn,restm,s,ansn=0,ansm=0;
	std::cin>>n>>m;
	restn=n/3;if(restn*3<n)restn++;
	restm=m/3;if(restm*3<m)restm++;
	long long k,i=n-restn,j=restn;
	while(i!=j)
	{
		ansn+=j;
		k=j; 
		j=i-j;
		i=k;
	}
	ansn+=j;
	i=m-restm,j=restm;
	while(i!=j)
	{
		ansm+=j;
		k=j; 
		j=i-j;
		i=k;
	}
	ansm+=j;
	std::cout<<std::max(m*ansn,n*ansm);
	return 0;	
} 

信息

递交者
类型
递交
题目
切蛋糕 T1
题目数据
下载
语言
C++
递交时间
2017-10-05 18:18:05
评测时间
2017-10-05 18:18:05
评测机
分数
0
总耗时
≥8058ms
峰值内存
≥320.0 KiB