赵乐ACM

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2012年3月22日

摘要: 1. 试了各种数据类型保存输入的字符串,比如string,字符数组。在string类型中,不能一个一个字符地拷贝字符串,因为字符串末尾还有一个字符。2. 字符型数字转换成int类型;3. 自我感觉change函数写的比较巧妙,跟Curling 2.0有点类似。是把一个数组(有重复元素)无重复的放到另外一个数组。#include #include #include #include #include using namespace std; int telnum[100010]; int tel[100010][7]; int n; struct Node { int ans; ... 阅读全文
posted @ 2012-03-22 17:48 赵乐ACM 阅读(150) 评论(0) 推荐(0)

摘要: 1.字符型数字转换成int型(http://topic.csdn.net/t/20060329/20/4649488.html) 阅读全文
posted @ 2012-03-22 17:42 赵乐ACM 阅读(105) 评论(0) 推荐(0)

摘要: 1.scanf()的用法,见百度百科;2.scanf用来接收小数,把输入变量声明为float不行,声明为double就可以了,scanf里%f不行,但是%lf就行了。#include int main() { double sum, in; int num; while(scanf("%lf", &in) != EOF) { if(in == 0.00) break; num = 1; sum = 0.5; while(sum < in) { ... 阅读全文
posted @ 2012-03-22 11:10 赵乐ACM 阅读(111) 评论(0) 推荐(0)

摘要: 1.输出2位小数,用%.2f表示。%m.nf表示输出数据共占m列,其中有n位小数,左端补齐;#include int main() { float num[12], ans = 0; for(int i = 0; i < 12; i++) { scanf("%f", &num[i]); ans = ans + num[i]; } printf("%c%.2f", '$', ans / 12); return 0; } 阅读全文
posted @ 2012-03-22 10:26 赵乐ACM 阅读(113) 评论(0) 推荐(0)