QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#69012#5115. Clone RanranzhuibaoWA 39ms3528kbC++201.3kb2022-12-22 13:55:472022-12-22 13:55:49

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-12-22 13:55:49]
  • 评测
  • 测评结果:WA
  • 用时:39ms
  • 内存:3528kb
  • [2022-12-22 13:55:47]
  • 提交

answer

#define _CRT_SECURE_NO_WARNINGS
#define IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0) 
#include<unordered_map>
#include<unordered_set>
#include<bits/stdc++.h>
#include<array>
using namespace std;
typedef long long ll;
typedef pair<ll, ll>pi;
#define int ll
#define X first
#define Y second
#define fer(i,a,n) for(ll i=a;i<=n;i++)
#define ref(i,n,a) for(ll i=n;i>=a;i--)
#define endl '\n'
#define mem(a,x) memset(a,x,sizeof a)
#define ac IO;int t;cin>>t;while(t--)solve()
#define AC signed main(){IO;solve();}
#define NO {cout<<"No"<<endl;return;}
#define YES {cout<<"yes"<<endl;return;}
#define re(a) {cout<<a<<endl;return;}
#define all(v) v.begin(),v.end()
//ofstream fout("out.txt", ios::out);
//ifstream fin("in.txt", ios::in);
//#define cout fout
//#define cin fin
//--------------------瑞神神中神--------------------

inline int qdiv(int a, int b)
{
	return a / b + ((a - a / b * b) & 1);
}

int a, b, c;

int qmi(int a, int b)
{
	int ans = 1;
	while (b)
	{
		if (b & 1)ans *= a;
		a *= a;
		b >>= 1;
	}
	return ans;
}

void solve()
{
	cin >> a >> b >> c;
	int ans = 1e18, sum = 0, x = 1;
	while (x <= 2 * c)
	{
		int res = sum + qdiv(c, x) * b;
		sum += a;
		x <<= 1;
		ans = min(ans, res);
	}
	cout << ans << endl;
}

signed main()
{
	ac;
}

详细

Test #1:

score: 100
Accepted
time: 2ms
memory: 3528kb

input:

5
1 1 1
2 3 3
9 9 9
3 26 47
1064 822 1048576

output:

1
7
45
44
21860

result:

ok 5 number(s): "1 7 45 44 21860"

Test #2:

score: -100
Wrong Answer
time: 39ms
memory: 3340kb

input:

99500
1000000000 1000000000 1000000000
1000000000 1000000000 999999999
1000000000 1000000000 999999998
1000000000 1000000000 999999997
1000000000 1000000000 999999996
1000000000 1000000000 999999995
1000000000 1000000000 999999994
1000000000 1000000000 999999993
1000000000 1000000000 999999992
10000...

output:

30000000000
31000000000
30000000000
31000000000
30000000000
31000000000
30000000000
31000000000
30000000000
31000000000
29999999999
30999999998
29999999999
30999999998
29999999999
30999999998
29999999999
30999999998
29999999999
30999999998
29999999998
30999999996
29999999998
30999999996
29999999998
...

result:

wrong answer 1st numbers differ - expected: '31000000000', found: '30000000000'