2016 where to go net pen question one

Source: Internet
Author: User

Write your own code, for everyone to refer to

#include <iostream> #include <vector> #include <stdio.h> #include <stdlib.h>//#include < cstdio.h> #include <string> #include <map> using namespace std;       struct kenerl{ int major; int mirror; int level;};   kenerl Getkernel (String str) { int len = str.length ();  int i = 0; vector<int> Temp (3,-1 );  int index = 0; while (i<len)  {  int number = 0;  while (I<len && str[i]!= '. ')   {      number= number*10+ (str[i]-' 0 ');    i++; }  temp[index]= number;& nbsp index++;  I++; } kenerl res; res.major = temp[0]; res.mirror = Temp[1]; res.level = Temp [2]; return Res; } int Main () {   int n; cin>>n; vector<string > dict; if (n==0)  {  cout<< "no stable available" <<endl;  return 0; }  for (int i = 0; i<= n;i++)  {  string buf;  getline (cin,buf); //cout<<buf<<endl;   Dict.push_back (BUF);  }  /*map<int,vector<kenerl>> dictKenerl;*/  Kenerl maxkenerl; maxkenerl.major = -1; maxkenerl.mirror =-1;  maxkenerl.level = -1; for (int i =1;i <dict.size (); i++)  {  String temp = dict[i];  Kenerl num = Getkernel (temp);  if (num.mirror%2==0)/ /mirror 2  {   if (num.major>maxkenerl.major)//   {    Maxkenerl = num;     }else if (num.major = = maxkenerl.major)    {    if (num.mirror>maxkenerl.mirror)     {     maxkenerl = num;   }else if (num.mirror = = maxkenerl.mirror)     {&N Bsp    if (num.level>=maxkenerl.level)      {      Maxkenerl = num;    &N BSP;}       }else    {   //xiaoyu   }    }   else   {   //xiaoyu  & nbsp;}  }  } //string res; //int ntemp =0; //std::stringstream ss; //string strTest;   if (maxkenerl.major >0)  {  cout<<maxkenerl.major; } if (maxKenerl.mirror >0)  {  cout<< "." <<maxkenerl.mirror; }  if (maxkenerl.level>0)  {  cout<< "." <<maxkenerl.level; }  if (Maxkenerl.major = =-1 && maxkenerl.level ==-1 && Maxkenerl.mirror ==-1)  {  cout<< "no stable available" <<endl; } cout<<endl;  system ("pause");  return 0;}

2016 where to go net pen question one

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.