摘要: If you are a fan of Harry Potter, you would know the world of magic has its own currency system -- as Hagrid explained it to Harry, "Seventeen silver 阅读全文
posted @ 2020-02-10 18:16 PennyXia 阅读(118) 评论(0) 推荐(0) 编辑
摘要: People in Mars represent the colors in their computers in a similar way as the Earth people. That is, a color is represented by a 6-digit number, wher 阅读全文
posted @ 2020-02-10 18:14 PennyXia 阅读(107) 评论(0) 推荐(0) 编辑
摘要: A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a palindromic number 阅读全文
posted @ 2020-02-10 18:12 PennyXia 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 如果你是哈利·波特迷,你会知道魔法世界有它自己的货币系统 —— 就如海格告诉哈利的:“十七个银西可(Sickle)兑一个加隆(Galleon),二十九个纳特(Knut)兑一个西可,很容易。”现在,给定哈利应付的价钱 P 和他实付的钱 A,你的任务是写一个程序来计算他应该被找的零钱。 输入格式: 输入 阅读全文
posted @ 2020-02-10 18:09 PennyXia 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 输入两个非负 10 进制整数 A 和 B (≤),输出 A+B 的 D (1)进制数。 输入格式: 输入在一行中依次给出 3 个整数 A、B 和 D。 输出格式: 输出 A+B 的 D 进制数。 输入样例: 123 456 8 输出样例: 1103 思路1: 用一个字符串str存储除d之后的余数,使 阅读全文
posted @ 2020-02-10 18:06 PennyXia 阅读(169) 评论(0) 推荐(0) 编辑
摘要: Given any string of N (≥) 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 阅读全文
posted @ 2020-02-10 18:03 PennyXia 阅读(192) 评论(0) 推荐(0) 编辑
摘要: 本题要求你写个程序把给定的符号打印成沙漏的形状。例如给定17个“*”,要求按下列格式打印 ***** *** * *** ***** 所谓“沙漏形状”,是指每行输出奇数个符号;各行符号中心对齐;相邻两行符号数差2;符号数先从大到小顺序递减到1,再从小到大顺序递增;首尾符号数相等。 给定任意N个符号, 阅读全文
posted @ 2020-02-10 12:38 PennyXia 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 美国总统奥巴马不仅呼吁所有人都学习编程,甚至以身作则编写代码,成为美国历史上首位编写计算机代码的总统。2014 年底,为庆祝“计算机科学教育周”正式启动,奥巴马编写了很简单的计算机代码:在屏幕上画一个正方形。现在你也跟他一起画吧! 输入格式: 输入在一行中给出正方形边长 N(3)和组成正方形边的某种 阅读全文
posted @ 2020-02-10 12:18 PennyXia 阅读(149) 评论(0) 推荐(0) 编辑