2019独角兽企业重金招聘Python工程师标准>>>

第一题

#include "stdafx.h"
#include<iostream>
#include<fstream>
#include<vector>
#include<string>
using namespace std;string getNumber(int count)
{switch(count){case 2:  return "double";case 3:  return "triple";case 4:  return "quadruple";case 5:  return "quintuple";case 6:  return "sextuple";case 7:  return "septuple";case 8:  return "octuple";case 9:  return "nonuple";case 10: return "decuple";default: return "";}
}string getNum(int c)
{
//  cout<<"c:"<<c<<endl;switch(c){case 0: return "zero";case 1: return "one";case 2: return "two";case 3: return "three";case 4: return "four";case 5: return "five";case 6: return "six";case 7: return "seven";case 8: return "eight";case 9: return "nine";default: return "";}
}void printNumber(string s, vector<int> num,int seq)
{if(num.size() ==0)return;int start = 0 ;cout<<"Case #"<<seq+1<<":";while(num.size() != 0){int end = num[0] ;num.erase(num.begin());for(int i = start ; i < start + end ; ){int count = 0;while((i + count) < (start + end) && s[i] == s[i + count]  )count ++;if(count == 1)cout<<" "<<getNum(s[i] - '0');else            cout<<" "<<getNumber(count)<<" "<<getNum(s[i]-'0');i += count;}start += end;}cout<<endl;
}int main(int argc, char* argv[])
{
//  freopen("D:\\in.txt", "r", stdin);//freopen("D:\\out.txt", "w", stdout);int n;string str,s;cin >>n;getline(cin,str);for(int i = 0 ; i < n ; i ++){vector<int> vec;int temp = 0;getline(cin,str);bool tag = true;for(int j = 0 ; j < str.length() ; j ++){if(str[j] == ' ' && tag){tag = false;s = str.substr(0,j);}if(str[j] >= '0' && str[j] <= '9' && tag == false){temp = temp *10 + str[j] - '0';}if(str[j] == '-'   && tag == false){vec.push_back(temp);temp = 0;}}vec.push_back(temp);printNumber(s,vec,i);}return 0;
}

转载于:https://my.oschina.net/liangxiao/blog/163497

google compute test Problem 1题相关推荐

  1. 云片php_云片:Google Compute Engine

    云片php Google Compute Engine is a computing service in cloud where you can run large workloads at Goo ...

  2. FZU - 2037 -Maximum Value Problem(规律题)

    Let's start with a very classical problem. Given an array a[1-n] of positive numbers, if the value o ...

  3. Poj1207 The 3n + 1 problem(水题(数据)+陷阱)

    一.Description Problems in Computer Science are often classified as belonging to a certain class of p ...

  4. hdu-5867 Water problem(水题)

    题目链接: Water problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Othe ...

  5. 英特尔Skylake处理器全面入驻Google Compute Engine

    至顶网服务器频道 06月01日 新闻消息:根据谷歌公司本周三公布的消息,其Google Cloud正在将英特尔公司提供的Skylake处理器引入Compute Engine.目前新一代处理器已经开始在 ...

  6. Codeforces Round #360 (Div. 2) C. NP-Hard Problem 水题

    C. NP-Hard Problem 题目连接: http://www.codeforces.com/contest/688/problem/C Description Recently, Pari ...

  7. HDOJ(HDU) 2123 An easy problem(简单题...)

    Problem Description In this problem you need to make a multiply table of N * N ,just like the sample ...

  8. (Google)谷歌笔试算法题:要求相邻的两个数都不小于或者不大于其本身的排序

    如题,要求相邻的两个数都不小于或者不大于其本身的排序, 那么也就是说每个数字必须同时大于等于或者小于等于它左右两边的数字,例如   3>=2<=6,那么这里2就是同时同于等于3且小于等于6 ...

  9. 2020牛客多校第3场:[Points Construction Problem + 思维题+构造]

    题目链接 题目大意:就是给你n个边长为1的正方形,要求用这些正方形拼成周长为m的图形,并输出这些正方形的坐标,如果没有输出No 首先如果这些正方形都零散分布那么周长就是4∗n4*n4∗n,如果将这些正 ...

最新文章

  1. XCMS V1.0 Beta1 发布
  2. 第十六届智能车竞赛广东省线上比赛成绩汇总
  3. 复现经典:《统计学习方法》第 7 章 支持向量机
  4. 使用jQuery操作Cookies的实现代码
  5. android中控制ListView宽度和高度
  6. 小程序 | 使用 npm 模块配置 Vant Weapp 框架
  7. 大数据公司Palantir曾向法拉第未来投资2500万美元
  8. 倪飞曝腾讯红魔6更多细节:搭载业内顶级散热技术
  9. 类继承和初始化类的执行顺序
  10. ScalaReact式编程书
  11. C++中vector的访问和赋值
  12. idea前端可视化_jsp可视化开发工具_netbeans jsp可视化_idea 可视化开发 jsp
  13. Cadence之双击(DSN/brd)文件打开变新建文件的解决方法
  14. python群发邮箱软件下载_python qq邮件群发
  15. 美国服务器托管机房如何选择?
  16. 使用IntelliJ IDEA 配置Maven(入门)
  17. Gitee配置静态页面
  18. C语言布斯乘法算法,布斯Booth算法带符号位的乘法verilog语言实现booth算法
  19. 使用FTP下载文件资源
  20. 《MongoDB入门教程》第21篇 CRUD之删除文档

热门文章

  1. C#:System.Data.Common命名空间(数据库抽象工厂的使用)
  2. PHP 获取页面地址参数详解整理
  3. svn迁移,备份,重装系统后恢复数据 收藏
  4. Appium+python自动化(十五)- Android 这些基础知识,你知多少???(超详解)...
  5. 学习进度 - 004
  6. 【洛谷 P2303】 [SDOi2012]Longge的问题 (欧拉函数)
  7. 数论-朴素卢卡斯(Lucas)模板
  8. 框架--NoHttp和OkHttp哪个好用,Volley和NoHttp哪个好用?
  9. Linux 命令find、grep
  10. E 和 ? extends E的区别