牛客网机试
Fivethousand5000
已经结束叻,很难的啦
展开
-
牛客网-Pancake sorting
题目描述We start with a stack n of pancakes of distinct sizes. The problem is to convert the stack to one in which the pancakes are in size order with the smallest on the top and the largest on the bottom. To do this, we are allowed to flip the top k pancakes原创 2020-07-23 12:42:49 · 156 阅读 · 0 评论 -
牛客网-反序数
来源:牛客网题目:题目描述设N是一个四位数,它的9倍恰好是其反序数(例如:1234的反序数是4321)求N的值输入描述:程序无任何输入数据。输出描述:输出题目要求的四位数,如果结果有多组,则每组结果之间以回车隔开。#include<stdio.h>#include<stdlib.h>#include<cstdio>#include<iostream>#include<string>#include<algorithm原创 2020-07-22 13:40:05 · 216 阅读 · 0 评论 -
农夫过河问题
题目描述有一个农夫带一只羊、一筐菜和一只狼过河。如果没有农夫看管,则狼要吃羊,羊要吃菜。但是船很小,只够农夫带一样东西过河。问农夫该如何解此难题?我的代码:#include<cstdio>#include<iostream>#include<stdlib.h>#include<cstring>#include<vector>#include<queue>#include<set>using names原创 2020-06-22 00:37:20 · 1653 阅读 · 0 评论 -
加法等式
题目描述设a、b、c 均是0 到9 之间的数字,abc、bcc 是两个三位数,且有:abc+bcc=532。求满足条件的所有a、b、c 的值。我的代码:#include<cstdio>#include<iostream>#include<stdlib.h>using namespace std;int main(){ for (int a = 0; a <= 9; a++) { for (int b = 0; b <= 9; b++)原创 2020-06-19 10:20:12 · 196 阅读 · 0 评论 -
[编程题]完数与盈数
链接:https://www.nowcoder.com/questionTerminal/df0d850e41894d06a165bf445ec8a8b4?answerType=1&f=discussion来源:牛客网一个数如果恰好等于它的各因子(该数本身除外)子和,如:6=3+2+1,则称其为“完数”;若因子之和大于该数,则称其为“盈数”。求出2 到60 之间所有“完数”和“盈数”,并以如下形式输出: E: e1 e2 e3 …(ei 为完数) G: g1 g2 g3 …(gi 为盈数)我的原创 2020-06-19 10:10:22 · 509 阅读 · 0 评论 -
反序相等
设N是一个四位数,它的9倍恰好是其反序数(例如:1234 的反序数是4321),求N的值。我的代码:#include<cstdio>#include<iostream>#include<stdlib.h>#include<string>#include<algorithm>using namespace std;int main(){ for (int i = 1000; i <= 1111; i++) { st原创 2020-06-19 00:51:13 · 182 阅读 · 0 评论 -
邮票
某人有8 角的邮票5 张,1 元的邮票4 张,1 元8 角的邮票6 张,用这些邮票中的一张或若干张可以得到多少中不同的邮资?我的代码:#include<cstdio>#include<string>#include<iostream>#include<algorithm>#include<map>using namespace std;int main(){ map<float, bool> value; fo原创 2020-06-17 20:45:47 · 215 阅读 · 0 评论 -
对称平方数
题目描述打印所有不超过n(n<256)的,其平方具有对称性质的数。如11*11=121。#include<cstdio>#include<string>#include<iostream>using namespace std;int main(){ bool is_symmetric(string str); for (int i = 1; i < 256; i++) { string str = std::to_string(i*i原创 2020-06-17 18:25:04 · 317 阅读 · 0 评论 -
problemC
输入描述:有多组数据,输入数据的第一行为一个正整数,表示字符序列的数目,每组数据为一行字符序列。输出描述:对每个字符序列,取出所得整数的最大素因子,若字符序列中没有数字或者找出的整数为0,则输出0,每个整数占一行输出。示例1输入3sdf0ejg3.f?9f?4afd0s&2d79*(gabcde输出138570我的代码:#include<iostream>#include<cstdio>#include<string>#in原创 2020-06-17 12:55:22 · 142 阅读 · 0 评论