fan xing

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/erchouchou/article/details/78702487
#include <iostream>
using namespace std;
template <class T>
class Demo
{
    T a, b;
public :
    Demo(T a, T b)
    {
        this->a = a;
        this->b = b;
    }
    T add()
    {
        return a + b;
    }
};
int main()
{
    int a, b;
    double e, f;
    cin>>a>>b>>e>>f;
    Demo<int> d(a, b);
    int c = d.add();
    Demo<double> g(e, f);
    cout<<c<<" "<<g.add()<<endl;
}

阅读更多
换一批

Wu Xing

03-29

nnThe Wu Xing, or the Five Movements, Five Phases or Five Steps/Stages, are chiefly an ancient mnemonic device, in many traditional Chinese fields.nnThe doctrine of five phases describes two cycles, a generating or creation cycle, also known as "mother-son", and an overcoming or destruction cycle, also known as "grandfather-nephew", of interactions between the phases.nnGenerating:nnWood feeds Fire;nFire creates Earth (ash);nEarth bears Metal;nMetal carries Water (as in a bucket or tap, or water condenses on metal);nWater nourishes Wood.nOvercoming:nnWood parts Earth (such as roots) (or Trees can prevent soil erosion );nEarth absorbs (or muddies) Water (or Earth dam control the water);nWater quenches Fire;nFire melts Metal;nMetal chops Wood.nWu XingnnWith the two types of interactions in the above graph, any two nodes are connected by an edge.nnProblemnnIn a graph with N nodes, to ensure that any two nodes are connected by at least one edge, how many types of interactions are required at least? Here a type of interaction should have the following properties:nnIt can be represented as a set of directed edges in the graph.nFor each type of interaction, there should be one and only one edge starting at each node.nFor each type of interaction, there should be one and only one edge ending at each node.nThe interactions are made up of cycles, i.e. starting from an arbitrary node and following the edges with the same type of interaction, you can always reach the starting node after several steps.nInputnnFor each test case, there's a line with an integer N (3 <= N < 1,000,000), the number of nodes in the graph.nnN = 0 indicates the end of input.nOutputnnFor each test case, output a line with the number of interactions that are required at least.nnSample Inputnn5n0nSample Outputnn2

没有更多推荐了,返回首页