(1)使用FOR循环:#includeusing namespace std;int main(){ int i=1; int sum=0; for(;iusing namespace std;int add(int);//因为有返回值,故不能定义为voidint main(){ int a...
分类:
其他好文 时间:
2014-08-04 17:09:17
阅读次数:
209
#include using namespace std;int main(){ int n,a,sum=0; cout>n>>a; for(int i=1;i<=n;i++) { sum+=a; a=a+10*a;//不断赋值替换之前的数值 } cout<<sum<<end...
分类:
其他好文 时间:
2014-08-04 17:03:47
阅读次数:
213
(1)使用FOR语句,并奇数偶数分开计算再求和#includeusing namespace std;int main(){ int i,j; int sum=0,sum1=0,sum2=0;//求和之前必须先初始化为0,不然返回一个很奇怪的值 for(i=1;i=-100;j--,j--)/...
分类:
其他好文 时间:
2014-08-04 17:03:27
阅读次数:
182
# include
# include
using namespace std;
int main()
{
int n,m,i,sum,cot,flag,j;
int map[80040];
int a[40010];
int ans1;
int ans2;
while(~scanf("%d%d",&n,&m))
{
ans1=ans2=40010;
memset(map...
分类:
其他好文 时间:
2014-08-04 14:33:47
阅读次数:
180
题意:中文题,你懂得。。。
思路:建两个数组,一个标记,一个放答案(就是最快能处理的任务点), 在输入数据的时候标记改位置已经有任务了,并且找出来一个最大的数max。然后从max+1,出发从大到小,依次用temp定义没有任务的序号,如果是没有被标记那么就将该处的答案定义为temp。
题目链接 点击打开链接
代码:
#include
#include
#define MAXN 200005
...
分类:
其他好文 时间:
2014-08-04 14:32:57
阅读次数:
187
在JavaScript中有一种特殊的数据类型---Function类型,JavaScript的每个函数都是Function类型的实例。由于函数是对象,因此函数名实际上也是一个指向函数对象的指针,不会与某个函数绑定。
function sum(num1)
{
return num1 +100;
}
sum = function(num1)
{
return num1 +200;
}
alert(sum(200)); //400...
分类:
编程语言 时间:
2014-08-04 14:21:43
阅读次数:
198
题目链接
题意:给出N,M
执行如下程序:
long long ans = 0,ansx = 0,ansy = 0;
for(int i = 1; i
for(int j = 1; j
if(gcd(i,j) == 1) ans ++,ansx += i,ansy += j;
cout
思路: 首先要会莫比乌斯,然后对于ans,自然是非常好求...
分类:
其他好文 时间:
2014-08-04 14:20:37
阅读次数:
220
使用STL容器 multiset
代码:
#include
#include
#include
using namespace std;
typedef multiset > intSet;
typedef multiset >::iterator intIter;
void findMaxNum(const vector &data,int k){
intSet Max;
...
分类:
其他好文 时间:
2014-08-04 14:20:17
阅读次数:
197
Luck and LoveTime Limit: 10000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5262Accepted Submission(s): 1317Prob...
分类:
其他好文 时间:
2014-08-04 14:10:27
阅读次数:
341
/** POJ 2488* DFS进行遍历就好,记录走过的路径,只要不重复地走过p*q个方格就行了(结束条件) */#include #include #include using namespace std;const int Max = 30; int kase;int p,q;int vis[...
分类:
其他好文 时间:
2014-08-04 14:00:37
阅读次数:
175