1计算1+2+3...+99+100的和.a---intsum=0,i=0;while(i<101){sum=sum+i;i++;}printf("%d",sum);b--intsum=0,i=1;//存储值do{sum=sum+i;//现执行一次循环体,在判断条件i++;}while(i<101);printf("%d",sum);2//100以内13倍数之和intsum=0,i=1;while(i<101){if(i%13==0){//..
分类:
其他好文 时间:
2014-08-03 08:01:25
阅读次数:
244
对于集合的遍历首选方法是for-each
for(Element e :c){
doSomething(e);
}
这是1.5版本之后的做法;java1.5之前使用的是Iterator迭代器。
为了弄清楚为啥比普通的for循环或者whlie循环好,请看一下代码
Iterator i=c.iterator();
while(i.hasNext()){...
分类:
其他好文 时间:
2014-08-02 23:26:54
阅读次数:
356
#include #include #include using namespace std;int main(){ char str[10002]; while (gets(str)) { sets; s.insert("aa"); s....
分类:
其他好文 时间:
2014-08-02 23:24:34
阅读次数:
280
#include int main() { char str[10002]; char a[1002],b[1002]; while(gets(str)) { sscanf(str,"%s %s",a,b); printf("%s\n",a); ...
分类:
其他好文 时间:
2014-08-02 23:16:24
阅读次数:
314
Wormholes
Time Limit: 2000MS
Memory Limit: 65536K
Total Submissions: 30766
Accepted: 11157
Description
While exploring his many farms, Farmer John has discovered a nu...
分类:
其他好文 时间:
2014-08-02 18:30:23
阅读次数:
317
题目链接:点击打开链接
#include
#include
#include
using namespace std;
#define INF 0x3f3f3f3f
#define eps 1e-8
#define pi acos(-1.0)
typedef long long ll;
int main()
{
int i, j;
double m,n;
while...
分类:
其他好文 时间:
2014-08-02 18:20:43
阅读次数:
233
括号配对问题时间限制:3000ms | 内存限制:65535KB难度:3描述现在,有一行括号序列,请你检查这行括号是否配对。输入第一行输入一个数N(0#include using namespace std;int main(){ int N; cin>>N; while(N--)...
分类:
其他好文 时间:
2014-08-02 17:58:53
阅读次数:
170
fmod#include #includeint main(int argc, char *argv[]){ float a,b,c; while (scanf("%f %f",&a,&b)) { c=fmod(a,b); printf("%f\n",c...
分类:
其他好文 时间:
2014-08-02 17:52:13
阅读次数:
243
Shaders are simple programs that describe the traits of either a vertex or
a pixel.
Vertex shaders describe the traits (position, texture
coordinates, colors, etc.) of a vertex, while pixel shade...
分类:
其他好文 时间:
2014-08-02 15:30:43
阅读次数:
377
现在计算机的cpu一般都是多核的,而很多程序都没有进行多核优化,这就没有办法充分利用cpu的性能了。比如用vs2010中写一个while(1)循环,在旧电脑上cpu运行是占100%的,而在新的4核电脑上运行则只占25%,似乎没办法再高了。很多地方说用openmp可以发挥多核处理的能力,不过我在程序中...
分类:
其他好文 时间:
2014-08-02 15:07:13
阅读次数:
173