- 博客(7)
- 收藏
- 关注
原创 code[vs] 1204 寻找子串位置
#include#includeusing namespace std;const int maxn = 110;char a[maxn] , b[maxn];int main(){ cin >> a >> b; //直接用strstr获得小串在大串里的指针 //cout << (strstr(a,b) - a)/sizeof(char)+1; //以大串的每一个字符开始去在小串
2017-06-22 15:41:16 712
原创 code[vs] 2235 机票打折
解释:精确到十位的四舍五入。//AuWind#include#includeusing namespace std;int main(){ int a; float b; cin >> a >> b; a = a * b / 10; if(a %10 >=5)cout << a - a%10 +10;//如果个位大于5,就减个位加10 else cout << a
2017-06-21 11:15:48 298
原创 code[vs] 1206 保留两位小数
解析:浮点数的输入和输出。流输出输入可以自动判断类型 ,标准输入以格式为准(需对应变量类型)//AuWind#include#includeusing namespace std;int main(){ double a; cin >> a; printf("%.2lf\n",a);}//AuWind#include#includeus
2017-06-21 10:58:31 754
原创 code[vs] 1203 判断浮点数是否相等
解析:1.使用的数据类型确定(1e-8),不能用float2.浮点数精确位数的比较技巧,用差的绝对值//AuWind#include #includeusing namespace std;int main(){ double a,b; cin >> a >> b; if(fabs(a - b)<1e-8){ cout << "yes";
2017-06-21 10:50:41 263
原创 code[vs]1202 求和
//AuWind#include using namespace std;int n , sum;int main(){ cin >> n; int t; while(n--){cin >> t;sum +=t;} cout << sum << "\n"; return 0;}
2017-06-21 10:43:52 337
原创 code[vs]1201 最小数和最大数
题目描述 Description输入n个数,n输入描述 Input Description第一行一个整数n接下来一行n个整数,每个整数不超过231 -1输出描述 Output Description最小和最大的数样例输入 Sample Input41 2 3 4样例输出 Sample Output1 4
2017-06-21 10:34:38 645
原创 NOIP C++ 生涯
不期待有较好的结果,只希望有坚持的历程,丰富在电脑前的人生,以不憾所谓的生涯。//AuWind#include#includeusing namespace std;int main(){ cout << "Welcome.\n"; printf("Hello world.\n"); return 0;}
2017-06-21 08:32:04 181
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人