文件名称:程设
介绍说明--下载内容来自于网络,使用问题请自行百度
1. 每条项链由N个随机排列的红色、白色和蓝色的珠子组成(3<=N<=350)
2. 参与者从项链的某处将它截断拉直;接着从一端向另外一端收集同颜色的珠子,直到碰到一个不同颜色的珠子为止;然后再从另外一端做同样的操作。(一端收集的珠子颜色可以不同于另一端的。)
3. 当遇到白色的珠子时,它既可以作为蓝色的珠子看待,也可以作为红色的珠子看待,由收集珠子时的需求决定。
4. 想办法找到一个截断项链的位置,能够尽量多地收集到同色的珠子,胜出者可免费获得珍珠项链一条。
现在请大家帮忙,编写一段程序,计算从某条项链中最多能够收集到多少个珠子,下面的例子展示了两条 N=29 时的项链:(1. Each necklace consists of N randomly arranged red, white and blue beads (3<=N<=350).
2. Participants cut and straighten the necklace somewhere; then collect the same color beads from one end to the other until they meet a different color bead; and then do the same thing from the other end. The color of beads collected at one end can be different from that collected at the other end. )
3. When encountering white beads, they can be viewed as either blue beads or red beads, depending on the needs of collecting beads.
4. Find a place to cut off the necklace and collect as many pearls of the same color as possible. The winner can get a pearl necklace free of charge.
Now please help me to write a program to calculate how many beads can be collected from a necklace. The following examples show two necklaces when N = 29:)
2. 参与者从项链的某处将它截断拉直;接着从一端向另外一端收集同颜色的珠子,直到碰到一个不同颜色的珠子为止;然后再从另外一端做同样的操作。(一端收集的珠子颜色可以不同于另一端的。)
3. 当遇到白色的珠子时,它既可以作为蓝色的珠子看待,也可以作为红色的珠子看待,由收集珠子时的需求决定。
4. 想办法找到一个截断项链的位置,能够尽量多地收集到同色的珠子,胜出者可免费获得珍珠项链一条。
现在请大家帮忙,编写一段程序,计算从某条项链中最多能够收集到多少个珠子,下面的例子展示了两条 N=29 时的项链:(1. Each necklace consists of N randomly arranged red, white and blue beads (3<=N<=350).
2. Participants cut and straighten the necklace somewhere; then collect the same color beads from one end to the other until they meet a different color bead; and then do the same thing from the other end. The color of beads collected at one end can be different from that collected at the other end. )
3. When encountering white beads, they can be viewed as either blue beads or red beads, depending on the needs of collecting beads.
4. Find a place to cut off the necklace and collect as many pearls of the same color as possible. The winner can get a pearl necklace free of charge.
Now please help me to write a program to calculate how many beads can be collected from a necklace. The following examples show two necklaces when N = 29:)
相关搜索: 定情信物 良乡足球场 郭老师爱合并果子
(系统自动生成,下载前可以参看下载内容)
下载文件列表
文件名 | 大小 | 更新时间 |
---|---|---|
5.定情礼物.cpp | 1314 | 2018-10-08 |
6.良乡足球场.cpp | 958 | 2018-10-09 |
7.郭老师爱合并果子.cpp | 2022 | 2018-10-14 |
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.