QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#670190#9296. Golden SpiritCoffeecat996Compile Error//C++14686b2024-10-23 20:47:232024-10-23 20:47:23

Judging History

你现在查看的是最新测评结果

  • [2024-10-23 20:47:23]
  • 评测
  • [2024-10-23 20:47:23]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long

void solve()
{
	int n, x, t;
	cin >> n >> x >> t;
	if(x <= (2*n-2)*t)
	  cout << 4*n*t << '\n';
	else{
		int ret=x+2*t+2*n*t;
		if(x-(2*n-2)*t <= t)
			ret=min(ret,x + 2*n*t);
//		  cout << x + 2*n*t << '\n';
		else{
			if(x-2*n*t <= 0)
				ret=min(ret,4*n*t+t)
//				ret=min(ret,(4*n+1)*t);
//			  cout << (4*n+1)*t << '\n';
			else
				ret=min(ret,x + 2*n*t+t);
//			  cout << x + (2*n+1)*t << '\n';
		}
		cout<< ret<<"\n";
	}
}
signed main()
{
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);std::cout.tie(0);
	int t=1;
	std::cin >>t;
	while(t--){
		solve();
	}
	return 0;
}

Details

answer.code: In function ‘void solve()’:
answer.code:18:53: error: expected ‘;’ before ‘else’
   18 |                                 ret=min(ret,4*n*t+t)
      |                                                     ^
      |                                                     ;
......
   21 |                         else
      |                         ~~~~