如何达到最快或空间最小?
2023-07-21 20:37:29
发布于:广东
51阅读
0回复
0点赞
我的最基础的代码
#include<iostream>
using namespacemespace std;
int main (){
int n;
cin>>n;
if(n>=100&&n<=9)cout<<0;
else cout<<1;
}
全部评论 8
如果需要详细讲解请联系我
2024-08-02 来自 浙江
0具体的代码给你
#include <iostream> using namespace std; bool daan(int n){ if(n >= 10 && n < 100) return true; return false; } int main(){ int n; cin >> n; if(daan(n)) cout << "1"; else cout << "0"; return 0; }
当然,这个只是我的代码,不一定为标准答案哦
2024-08-02 来自 浙江
0用string会不会更快点a
#include<bits/stdc++.h> using namespace std; int main(){ string a; cin>>a; cout<<(a.size()==2); }
2024-08-02 来自 浙江
0不要是小于等于100和小于等于9,这里可以调成 —— >100 && < 9 即可,也可以是(n >= 10 && n < 100)
2024-08-02 来自 浙江
0这样不就够了?
cout<<(int)((a>=10)&&(a<=99));2024-07-27 来自 广东
0cout << (n > 9 and n < 100 ? 0 : 1);三目运算符至高无上
2024-03-17 来自 上海
0呃,不需要"return 0;"吗
2023-07-21 来自 广东
0不一定需要
2023-07-21 来自 广东
0最好是加上,这是个好习惯
2023-07-21 来自 广东
0
发错了
上面的是错误的版本
#include<iostream>
using namespace std;
int main (){
int n;
cin>>n;
if(n>=100||n<=9)cout<<0;
else cout<<1;
}2023-07-21 来自 广东
0也不对吧,不是||,是&&吧
2024-03-16 来自 江苏
0
有帮助,赞一个