HBC14584Yuanyuan Long and His Ballons题解

水水月牙 算法基础篇 52 0
想要检验自己的编程水平?来试试全网最全C++题库,让您在挑战中不断进步。
Yuanyuan Long is a dragon like this picture?I don’t know, maybe you can ask him. But I’m sureYuanyuan Long likes ballons, he has a lot of ballons. One day, he gets n white ballons and k kinds of pigment, and he thought a problem: 1. Number these ballons b1, b2, …, to bn. 2. Link these ballons to a circle in order, and color these ballons. 3. He need to make sure that any neighbor ballons have different colors. He wants to know how many solutions to solve this problem. Can you get the answer to him?The answer maybe very large, get the answer MOD 100000007. For Example: with 3 ballons and 3 kinds of pigment Your answer is 3*2*1 MOD 100000007 = 6. The answer maybe large, you can use integer type long long.

Yuanyuan Long is a dragon like this picture?                                     I don’t know, maybe you can ask him. But I’m sure Yuanyuan Long likes ballons, he has a lot of ballons.           One day, he gets n white ballons and k kinds of pigment, and he thought a problem: 1.      Number these ballons b1, b2,  … , bi, …,  to bn. 2.      Link these ballons to a circle in order, and color these ballons. 3.      He need to make sure that any neighbor ballons have different colors. He wants to know how many solutions to solve this problem. Can you get the answer to him? The answer maybe very large, get the answer MOD 100000007. For Example: with 3 ballons and 3 kinds of pigment Your answer is 3*2*1 MOD 100000007 = 6.  The answer maybe large, you can use integer type long long.

HBC14584Yuanyuan Long and His Ballons题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
成为编程大师,不再是梦想!全网最全C++题库,助您开启编程新篇章。

标签: HBC14584Yuanyuan Long and His Ballons题解