上一页 1 ··· 21 22 23 24 25 26 27 28 29 ··· 31 下一页
摘要: 单词数Time Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 28671Accepted Submission(s): 6877 Problem Desc... 阅读全文
posted @ 2014-08-02 22:49 2014acm 阅读(100) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std;int main(){ char str[10002]; while (gets(str)) { sets; s.insert("aa"); s.... 阅读全文
posted @ 2014-08-02 22:30 2014acm 阅读(458) 评论(0) 推荐(0) 编辑
摘要: #include int main() { char str[10002]; char a[1002],b[1002]; while(gets(str)) { sscanf(str,"%s %s",a,b); printf("%s\n",a); ... 阅读全文
posted @ 2014-08-02 21:52 2014acm 阅读(208) 评论(0) 推荐(0) 编辑
摘要: 在我的学习过程中,从文件读取数据是一件很麻烦的事,所幸有sscanf()函数。 C语言函数sscanf()的用法sscanf() - 从一个字符串中读进与指定格式相符的数据. 函数原型: int sscanf( string str, string fmt, mixed var1, mixed... 阅读全文
posted @ 2014-08-02 21:44 2014acm 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 平均数 Time Limit:1000MS Memory Limit:32768KDescription:求若干个整数的平均数。Input:输入数据含有不多于5组的数据,每组数据由一个整数n(n≤50)打头,表示后面跟着n个整数。Output:对于每组数据,输出其平均数,精确到小数点后3位,每个平均... 阅读全文
posted @ 2014-08-02 21:28 2014acm 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 数据间隔常用设置方法:输出空格符或回车换行符。指定数据输出宽度: 用C++提供的函数setw()指定输出数据项的宽度。 setw()括号中通常给出一个正整数值,用于限定紧跟其后的一个数据项的输出宽度。如:setw(8)表示紧跟其后的数据项的输出占8个字符宽度。数据项在 8个宽度的 右端几点说明:1.... 阅读全文
posted @ 2014-08-02 20:45 2014acm 阅读(1055) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std;int main (){ double a=123456.343001; cout#include using namespace std;int main (){ double a=123456.343001;... 阅读全文
posted @ 2014-08-02 20:36 2014acm 阅读(4422) 评论(0) 推荐(0) 编辑
摘要: precision()#includeusing namespace std;int main(){float s=11.201 ;cout.precision(2); cout using namespace std;int main(){ float s=11.201... 阅读全文
posted @ 2014-08-02 20:19 2014acm 阅读(607) 评论(0) 推荐(0) 编辑
摘要: 用C其实也挺简单的,有个投机取巧的办法我的想法是,既然希望保留两位小数,那么就必须看第三位小数,如果大于5,就进位,那么我们可以让第三位加上5,因为最后第三位是舍掉的,因此无论怎么改变第三位也没有问题。这样就想起了强制类型转换,呵呵,自己乘上100,然后加上0.5,再强制类型转换成int,将第三位舍... 阅读全文
posted @ 2014-08-02 19:59 2014acm 阅读(8199) 评论(0) 推荐(0) 编辑
摘要: 以保留2位小数为例,代码如下:#include#includeusingnamespacestd;intmain(){doublea;cin>>a;coutc)&&((a+c)>b&&((b+c)>a))) { p=(a+b+c)/2; s=sqrt(p*(p-a)*(p-b)*(p-c)); pr... 阅读全文
posted @ 2014-08-02 19:52 2014acm 阅读(8321) 评论(0) 推荐(0) 编辑
上一页 1 ··· 21 22 23 24 25 26 27 28 29 ··· 31 下一页