首页
DreamJudge
院校信息
考研初试
机试真题
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
zxjrheaven
2025年3月15日 11:28
判断是否是整数 题解:暴力
P1031
回复 0
|
赞 2
|
浏览 458
#include <bits/stdc++.h> using namespace std; int main() { double a; while(cin>>a) { long long b=a; if(a-b==0)cout<<"Yes"<&...
GENARDING
2025年3月14日 13:09
还是那句话,计试能ac就行
P1031
回复 0
|
赞 0
|
浏览 348
#include <bits/stdc++.h> using namespace std; int main() { string s; while(cin>>s){ int count=0; for(int i=0;i<s.length();i++){ if(s[i]=='.'){ for(int j=1;j<s.length();j++) { if(s[j]=='0'){ count=0; }else{ count...
Candour
2024年5月24日 18:34
判断是否是整数(C++)题解:
P1031
回复 0
|
赞 3
|
浏览 929
#include<bits/stdc++.h> using namespace std; double n; int main() { while(cin >> n) { if(n - (int)n == 0) cout << "Yes" << endl; else cout << "No" << endl; } return 0; }
RingoCrystal
2024年4月6日 13:15
判断是否是整数 题解:3.000算整数
P1031
回复 0
|
赞 2
|
浏览 933
#include <bits/stdc++.h> using namespace std; int main(){ string s; while(cin>>s){ int flag=0; int tag=0; for(int i=0;i<s.size();i++){ if(s[i]=='.'){ flag=1; tag=i; break; } } if(tag!=0){ int flag2=0; for(int i=tag+1;i<s.si...
carrot_huan
2024年3月18日 15:15
判断是否是整数 题解:两个开关
P1031
回复 0
|
赞 1
|
浏览 728
#include<bits/stdc++.h> using namespace std; int main() { string str; while (cin >> str) { bool flag = false; bool flag2 = false; &...
huanghu
2024年3月15日 12:17
判断是否是整数 题解:c++暴力
P1031
回复 0
|
赞 0
|
浏览 664
#include<stdio.h> #include<iostream> #include<string> using namespace std; int main(){ string str; while(cin>>str){ int len = str.length(); bool flag = true; for(int i = 0; i<len; i++){ if(str[i] == '.' &&...
活着的传奇
2023年8月22日 11:05
判断是否是整数 题解:
P1031
回复 0
|
赞 2
|
浏览 1.3k
用判断是不是等于强制转换就可以了 #include<bits/stdc++.h> using namespace std; int main(){ float a; while(scanf("%f",&a)!=EOF){ if(a==(int)a) printf("Yes\n"); else printf("No\n"); } return 0; }
Hegel
2023年3月24日 14:21
判断是否为整数
P1031
回复 0
|
赞 2
|
浏览 2.4k
#include <iostream> #include <string> using namespace std; int main() { string s; while (getline(cin, s)) { int flag = 0; for (int i = 0, f = 0; i < s.size(); i++) { if (s[i] == '.') { f = 1; continue; } if (f == 1 && s[i] != '0') { ...
零壹
2023年3月23日 10:25
c-类型转换
P1031
回复 0
|
赞 8
|
浏览 2.7k
直接将一个数转换为整型,如果与原来的数相等,则是整数 #define _CRT_SECURE_NO_WARNINGS #include<stdio.h> int main() { double n; while (scanf("%lf", &n) != EOF) { int t = n; if (t==n)//t == n printf("Yes\n"); else printf("No\n"); } return 0; }
huangdashuaige
2023年2月20日 18:22
P1031 判断是否是整数
P1031
回复 0
|
赞 0
|
浏览 3.5k
#include <iostream> using namespace std; int main(){ double n=0.0;//双精度数声明(单精度应该也可以) while(cin>>n){ while(n>=1) n--;//由于双精度数用不了%,那就暴力自减 n==0?cout<<...
1
2
题目
判断是否是整数
题解数量
17
发布题解
在线答疑
热门题解
1
c-类型转换
2
判断是否为整数
3
判断是否是整数(C++)题解:
4
判断是否是整数 题解:3.000算整数
5
判断是否是整数 题解:
6
判断是否为整数
7
判断是否是整数 题解:暴力
8
1031判断是否为整数
9
题解:判断是否是整数
10
判断是否是整数(c++)