文章列表
#include<iostream>
//#include<cmath>
using namespace std;
int main()
{
double x,y;
int n1,n2;
while( cin >> n1 >> n2 )
{
x = y = 0.0;
if( n1 > n2)
{
swap(n1,n2);
}
for ( ...
- 2011-11-14 11:56
- 浏览 351
- 评论(0)
#include<iostream>
//#include<cmath>
using namespace std;
int main()
{
int n,x,sum;
while( cin >> n )
{
sum = 1;
for( int i = 0;i < n;i ++)
{
cin >> x;
if( x % 2 != 0)
{
...
- 2011-11-14 11:54
- 浏览 406
- 评论(0)
#include<iostream>
//#include<cmath>
using namespace std;
int lev(int n)
{
if((n % 4 == 0 && n % 100 != 0) || (n % 400 == 0))
{
return 1;
}
else return 0;
}
int main()
{
int month[2][13]=
{{0,31,28,31,30,31,30, ...
- 2011-11-14 11:53
- 浏览 389
- 评论(0)
#include<iostream>
using namespace std;
#define max 9
int main()
{
int Array[max];
/*for ( int i = 0;i < max;i ++)
{
Array[i] = max - i;
}*/
cout <<"原始数据:";
for ( int i = 0;i < max;i ++)
{
cin > ...
- 2011-11-12 18:48
- 浏览 311
- 评论(0)
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
int x;
while( cin >> x)
{
if( x < 0 || x > 100)
{
cout << "Score is error !" << endl;
}
else i ...
- 2011-11-12 18:45
- 浏览 512
- 评论(0)
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
double x;
cout.precision(2);
while( cin >> x)
{
cout << fixed << fabs(x) << endl;
}
system("pause");
}
- 2011-11-12 18:44
- 浏览 350
- 评论(0)
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
const double pi = 3.1415926;
double x;
cout.precision(3);
while( cin >> x )
{
cout << fixed << 4*pi*pow(x,3)/3 << endl;
}
system("p ...
- 2011-11-12 18:44
- 浏览 200
- 评论(0)
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
double x1,y1,x2,y2;
cout.precision(2);
while( cin >> x1 >> y1 >> x2 >> y2)
{
cout << fixed << sqrt(pow((x1-x2),2)+pow((y1-y2),2)) << endl;
...
- 2011-11-12 18:43
- 浏览 295
- 评论(0)
#include<iostream>
using namespace std;
int main()
{
char a[4];
while(cin >> a)
{
/*for( int i = 0;i < 3;i ++)
{
cin >> a[i];
}*/
if( a[0] > a[1])
swap(a[0],a[1]);
...
- 2011-11-11 10:28
- 浏览 285
- 评论(0)
/*
/解决本题的关键:通过公式条件:F(0)= 7, F(1) = 11,F(n) = F(n-1) + F(n-2) (n>=2). 找到规律。
由同余式的基本性质:
(1)自反性:a = a( mod m)。
以及同余式的四则运算法则:
(1)如果 a =b( mod m)且 c = d( mod m),则 a +c = (b + d)( mod m)。
可知,F(n) = F(n) ( mod m) = ( F(n-1) +F(n-2) )( mod m)。
根据题目已知条件:
Print the word"yes" if 3 divid ...
- 2011-11-11 10:27
- 浏览 258
- 评论(0)
#include<iostream>
using namespace std;
/*
int gcd( int a,int b)
{
int r = 0;
while(b!=0)
{
r = a%b;
a = b;
b = r;
}
return a;
}
*/
int gcd( int a,int b)
{
if(b==0)
{
...
- 2011-11-10 16:25
- 浏览 375
- 评论(0)
/*
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
int n,x;
double result;
cin >> n;
while(n--)
{
cin >> x;
result = log10((float)x);
while(x!=1)
{
...
- 2011-11-10 16:24
- 浏览 409
- 评论(0)
#include<iostream>
using namespace std;
int main()
{
int k,c,p=0,t;
int a,b;
cin >> k;
while(k--)
{
if(p>0)cout<<endl;
p ++;
c= 0;
while( cin >> a >> b)
{
if(a==0&&b==0)br ...
- 2011-11-10 16:23
- 浏览 423
- 评论(0)
#include<iostream>
using namespace std;
int main()
{
int f[10]={1,1,2};
double e[10]={1.0,2.0,2.5};
cout <<"n e\n";
cout <<"- -----------\n";
cout <<"0 1\n";
cout <<"1 2\n";
cout <<&qu ...
- 2011-11-10 16:22
- 浏览 459
- 评论(0)
#include<iostream>
using namespace std;
int main()
{
int i,a,sum;
int n;
while( cin >> n)
{
i = 0;
sum = 0;
if(n==0)break;
while(n--)
{
cin >> a;
if(i < ...
- 2011-11-10 16:21
- 浏览 412
- 评论(0)