#include
#include
#include
徐球弟代表高峰國小四年級出征去
9 年前
我的生活 我的工作 我的心情 就在這裡
#include
using namespace std;
class n3plus1
{
public:
int GetMaxCycle(int i,int j)
{
int max=0;
int temp;
for(;i<=j;++i)
{
temp=GetCycle(i,0);
max=temp>max?temp:max;
}
return max;
}
int GetCycle(int n,int temp)
{
++temp;
if(n==1)
{
return temp;
}
else if(n%2==0)
{
return GetCycle(n/2,temp);
}
else
{
return GetCycle(n*3+1,temp);
}
}
};
int main(int argc, char *argv[])
{
int m,n,max,min;
n3plus1 obj;
while(true)
{
cin >> m >> n;
if(cin.eof())
{
break;
}
max=m>n?m:n;
min=mcout << m << " " << n << " " << obj.GetMaxCycle(min,max) << endl;
}
}
#include
#include
#include
using namespace std;
class Point
{
public:
Point(float xx,float yy):x(xx) , y(yy){};
float x,y;
};
class Rectangle
{
public:
Point point1,point2;
Rectangle(float x1,float y1,float x2,float y2):point1(x1,y1),point2(x2,y2){};
bool IsIn(Point point)
{
return point.x > point1.x && point.x < point2.x && point.y < point1.y && point.y > point2.y;
}
};
class ACM476
{
public:
vectorrectangles;
vectorpoints;
};
int main(int argc, char *argv[])
{
ACM476 acm476;
while(true)
{
string input;
getline(cin,input);
istringstream ss;
ss.str(input);
string cmd;
float x1,y1,x2,y2;
ss >> cmd;
if(cmd=="*")
{
break;
}
switch(cmd[0])
{
case 'r':
ss >> x1;ss >> y1;ss >> x2;ss >> y2;
acm476.rectangles.push_back(Rectangle(x1,y1,x2,y2));
break;
}
}
while(true)
{
string input;
getline(cin,input);
istringstream ss;
ss.str(input);
float x,y;
ss >> x;
ss >> y;
if(x==9999.9f && y==9999.9f)
{
break;
}
acm476.points.push_back(Point(x,y));
}
for(vector::size_type ip =0;ip != acm476.points.size();++ip)
{
bool flag=false;
for(vector::size_type ir =0; ir != acm476.rectangles.size();++ir)
{
if(acm476.rectangles[ir].IsIn(acm476.points[ip]))
{
cout << "Point " << ip+1 << " is contained in figure " << ir+1 << endl;
flag=true;
}
}
if(!flag)
{
cout << "Point " << ip+1 <<" is not contained in any figure" << endl;
}
}
}
#include
using namespace std;
int main(int argc, char *argv[])
{
string input;
int cmt;
int i;
while(true)
{
cin >> input;
if(cin.eof())
{
break;
}
cmt=input.size();
for(i=0;i < cmt;++i)
{
input[i]-=7;
}
cout << input << endl;
}
}