机试
爬不上屋顶的猫
这个作者很懒,什么都没留下…
展开
-
日期类-北京理工大学复试上机题-王道考研
网址http://t.cn/E9RJUp4日期类描述编写一个日期类,要求按xxxx-xx-xx 的格式输出日期,实现加一天的操作。输入描述:输入第一行表示测试用例的个数m,接下来m行每行有3个用空格隔开的整数,分别表示年月日。测试数据不会有闰年。输出描述:输出m行。按xxxx-xx-xx的格式输出,表示输入日期的后一天的日期。示例1输入:21999 10 202001 1 31输出:1999-10-212001-02-01备注:注意个位数日期前面要有0。思路:注意边界原创 2021-06-05 15:33:10 · 153 阅读 · 0 评论 -
Day of week-王道考研-上海交通大学复试上机题
属于日期类问题:网址http://t.cn/E9YZLbi描述We now use the Gregorian style of dating in Russia. The leap years are years with number divisible by 4 but not divisible by 100, or divisible by 400. For example, years 2004, 2180 and 2400 are leap. Years 2005, 2181 and原创 2021-06-05 14:48:06 · 179 阅读 · 0 评论 -
日期差值-上海交通大学复试上机题-王道考研
网址:http://t.cn/E9Yz0LE描述有两个日期,求两个日期之间的天数,如果两个日期是连续的我们规定他们之间的天数为两天输入描述:有多组数据,每组数据有两行,分别表示两个日期,形式为YYYYMMDD输出描述:每组数据输出一行,即日期差值示例1输入:2011041220110422输出:11#include<iostream>using namespace std;int daytab[2][13] = { {0,31,28,31,30,31,3原创 2021-06-05 11:19:28 · 132 阅读 · 0 评论 -
Hello World for U(浙江大学复试上机题) 图形排版题
网址:http://t.cn/E9jizni描述Given any string of N (>=5) characters, you are asked to form the characters into the shape of U. For example, “helloworld” can be printed as: h d e l l r lowo That is, the characters must be printed in the original order,原创 2021-05-31 22:03:25 · 162 阅读 · 0 评论 -
repeater(北京大学复试上机题)图形排版
网址:http://t.cn/E9jcaVb描述Harmony is indispensible in our daily life and no one can live without it----may be Facer is the only exception. One day it is rumored that repeat painting will create harmony and then hundreds of people started their endless dra原创 2021-05-31 21:43:16 · 658 阅读 · 0 评论 -
与7无关的数 机试 王道考研
网址:http://t.cn/E9lOOZQ描述一个正整数,如果它能被7整除,或者它的十进制表示法中某个位数上的数字为7, 则称其为与7相关的数.现求所有小于等于n(n<100)的与7无关的正整数的平方和。输入描述:案例可能有多组。对于每个测试案例输入为一行,正整数n,(n<100)输出描述:对于每个测试案例输出一行,输出小于等于n的与7无关的正整数的平方和。示例1输入:21输出:2336分析:n<100,至多为2位数,对每个数的每一个位枚举最多就200次,所原创 2021-05-31 19:19:00 · 128 阅读 · 0 评论 -
对称平方数1 机试 王道考研
描述打印所有不超过256,其平方具有对称性质的数。如2,11就是这样的数,因为22=4,1111=121。输入描述:无任何输入数据输出描述:输出具有题目要求的性质的数。如果输出数据不止一组,各组数据之间以回车隔开。#include<iostream>#include<cmath>using namespace std;int Reverse(int x){ int revx = 0; while(x) { revx *=1原创 2021-05-31 19:08:25 · 76 阅读 · 0 评论