题目描述

描述
The Easter Rabbit laid n eggs in a circle and is about to paint them.
Each egg should be painted one color out of 7: red, orange, yellow, green, blue, indigo or violet. Also, the following conditions should be satisfied:
Each of the seven colors should be used to paint at least one egg.
Any four eggs lying sequentially should be painted different colors.
Help the Easter Rabbit paint the eggs in the required manner. We know that it is always possible.
输入描述
The only line contains an integer n — the amount of eggs (7 ≤ n ≤ 100).
输出描述
Print one line consisting of n characters. The i-th character should describe the color of the i-th egg in the order they lie in the circle. The colors should be represented as follows: "R" stands for red, "O" stands for orange, "Y" stands for yellow, "G" stands for green, "B" stands for blue, "I" stands for indigo, "V" stands for violet.
If there are several answers, print any of them.
用例输入 1
8
用例输出 1
ROYGRBIV
用例输入 2
13
用例输出 2
ROYGBIVGBIVYG
提示
The way the eggs will be painted in the first sample is shown on the picture:

问题分析

本题意思是给围成一个圈的n(n>=7)个蛋涂上红、橙、黄、绿、蓝、靛或紫(ROYGBIV)7种颜色,7种颜色都要用上并且相邻四个蛋颜色不重复。先把前4个和后3个蛋按顺序各涂一种颜色,然后再中间循环前四个颜色并输出。

#include<iostream>
#include<string>
using namespace std;
int main(){int n;string s="ROYGBIV";cin>>n;for(int i=0;i<4;i++){cout<<s[i];}for(int i=0;i<n-7;i++){cout<<s[i%4];}for(int i=4;i<7;i++){cout<<s[i];}return 0;
}

本题很简单,找找规律就好了^V^。

Easter Eggs相关推荐

  1. 关于复活节Easter的由来及习俗你了解多少呢

    复活节,也被 称为逾越节或复活周日,是一个庆祝耶稣基督由死复生的节日.据新约记载,公元30年他被 罗马人钉列在加略山的十字架上,下葬后的第三天却得以复活. Easter,also called Pas ...

  2. 关于“复活节Easter”知识,你了解多少?

    复活节是基督教纪念耶稣复活的节日.耶稣被钉死在十字架上,死后第三天复活.Christians say Jesus died on Friday. On the third day, he rose f ...

  3. 《题目与解读》红书 训练笔记目录《ACM国际大学生程序设计竞赛题目与解读》

    虽然2012年出版的老书了,但是是由三次世界冠军的上海交大ACM队出版的书籍,选择的题目是ACM经典中的经典,书中有非常详细的题解,可以学到很多东西,值得一刷. 目录 第一部分 第一章 数学 1.1 ...

  4. 剑桥少儿英语预备级教案(上) unit15 I can draw it.

    教学目的和要求(Teaching aims and demands) *使学生进一步掌握有关水果及有关动作的单词 *使学生能按照指令画出正确的图案 *使学生能模仿发出字母Oo及所给单词的读音 *使学生 ...

  5. 修改命令有趣的Linux命令

    上班之余抽点时间出来写写博文,希望对新接触的朋友有帮助.今天在这里和大家一起学习一下修改命令 以下是从网上收集的一些有趣的Linxu命令 1.cal 9 1752 17521 2 14 15 16 1 ...

  6. Unity多人游戏集合

    Unity多人游戏集合 Worlds Adrift Island Creator Worlds Adrift是一个社区性MMO游戏:每个岛屿都是由玩家精心构建的.使用免费的岛屿创造者工具,您便有机会创 ...

  7. Unity策略游戏集合

    Unity策略游戏集合 Telophase Telophase is a twin-stick dungeon crawler, set in Ancient Egypt. You must proj ...

  8. English trip V2 - 8 Holidays and Birthdays Teacher:Julia Key: at on in

    In this lesson you will learn to say dates and compare schedules /skɛdʒʊl/. 课上内容(Lesson) What day is ...

  9. ux设计_UX评论模式品牌知道规则并且也打破了规则

    ux设计 It started with a Sweetgreen on the corner of W 91st street and Broadway, three blocks from Cen ...

最新文章

  1. keystone连接mysql_3、KeyStone服务部署与验证
  2. oracle强大的包,ORACLE 程序包
  3. inputstream重新赋值之前需要close吗_变量提升真的搞懂了吗?打脸的一道题
  4. pwm控制舵机转动角度程序_Mixly 第15课 舵机的使用
  5. idea install 失败_idea maven install 卡住,无报错排查。
  6. 局域网ARP病毒的清理
  7. 数不清的Gmail邀请发放中……
  8. 7天内新闻前加 new
  9. GeoTiff及GDAL切图(java)
  10. Android Studio的Project有某个项目,Build Variants却没有,如何添加物已有项目?
  11. iOS:定制自适应大小的透明吐司弹框
  12. 学习Struts2框架笔记-第1天
  13. 抗体链接InP/ZnS量子点|量子点InP/ZnS表面修饰抗体偶联服务-齐岳生物
  14. RabbitMQ之Channel
  15. 形式语言与自动机 Part.4 正则语言,2DFA,MealyMoore机
  16. JavaFX战旗类游戏开发 第一课 概述
  17. 统计学中几种简单的检验方式
  18. 人脸识别-在视频中识别人脸
  19. AI-041: Python深度学习3 - 三个Karas实例-3
  20. 如何将图片裁剪成规定尺寸?怎样裁剪多余画面尺寸?

热门文章

  1. 《Windows办公指南》魔改C:\Windows\System32\drivers\etc\hosts实现一个数据中心
  2. msp430单片机复习内容
  3. 带你了解2021世界人工智能大会上的AI新趋势
  4. 迪士尼机器人芭蕾舞_迪士尼“跳跳虎”机器人来了!
  5. easyexcel 在 设置标题_七. EasyExcel标题加批注和标题字体填充红色
  6. 阿里云的PolarDB要开源了?这个数据库到底强在哪?
  7. 前端工程师简历怎么写才更容易进入面试呢?
  8. 相忘江湖不如相濡以沫(Ⅰ)
  9. [刷题]剑指offer C++语言刷题-多解法尝试
  10. 初级模拟电路:2-4 限幅器