题解:P17413 「IXOI R3」时间复杂度分析
xiaozhangsdj_hhh · · 题解
题目大意
给你一个数
如果这个数大于
如果这个数的平方大于
如果这个数的平方不大于
解法
很明朗,用基础if语句判断即可
#include<bits/stdc++.h>
using namespace std;
const long long c=5e8;
long long x;
int main(){
cin>>x;
if(x>c){
cout<<"O(1)";
}else{
if(x*x<=c){
cout<<"O(n^2)";
}else{
cout<<"O(n)";
}
}
}