B - Increase and Copy
B - Increase and Copy
题目描述
思路:
本题首先需要看出最快的方式为:将第一个数不断加一,然后进行拷贝,直至最终所得数字大于等于所给数字。设加了i次,拷贝了j次(即乘了j次),所得的即为(i+1)*(j+1)>=n,要使i+j最小,即使i+1+j+1最小,根据三角不等式,即得出i+1同j+1最接近sqrt(n)时最小。
#include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
scanf("
原创
2020-10-08 20:17:57 ·
195 阅读 ·
0 评论