赞
踩
Given an integer or a decimal XX, round it down to an integer and print the result.
5.90
5
We round down 5.905.90 to an integer, 55, and print it as an integer. Non-integer outputs such as 5.0 will be judged as incorrect.
字符串存储
1 0的话直接输出
2 不是0的话找小数点之前的数,加到字符串t种
code:
- #include<bits/stdc++.h>
- #define INF 0x3f3f3f3f
- #define N 100003
- #define mod 100000
- #define pb push_back
- #define x first
- #define y second
- #define ull unsigned long long
- #define ll long long
- using namespace std;
- int a[N];
- int main()
- {
- ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
- //freopen("in.txt", "r", stdin);
- //freopen("out.txt", "w", stdout);
- string s;
- cin >> s;
- if(s[0] == '0')
- {
- cout << 0 << endl;
- return 0;
- }
-
- string t;
- for(int i = 0;i < s.length();i++)
- {
- if(s[i] != '.')
- t += s[i];
- else
- break;
- }
- cout << t << endl;
- return 0;
- }
-
-

Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。