http://www.lightoj.com/volume_showproblem.php?problem=1023

题意:26字母全排列

思路:用next_permutation或者思维想一下都可以

/** @Date    : 2016-12-17-13.28
* @Author : Lweleth (SoungEarlf@gmail.com)
* @Link : https://github.com/
* @Version :
*/
#include<bits/stdc++.h>
#define LL long long
#define PII pair
#define MP(x, y) make_pair((x),(y))
#define fi first
#define se second
#define PB(x) push_back((x))
#define MMG(x) memset((x), -1,sizeof(x))
#define MMF(x) memset((x),0,sizeof(x))
#define MMI(x) memset((x), INF, sizeof(x))
using namespace std; const int INF = 0x3f3f3f3f;
const int N = 1e5+20;
const double eps = 1e-8; int main()
{
int T;
int cnt = 0;
cin >> T;
string s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
while(T--)
{
int n, m;
cin >> n >> m;
string t = s;
int ct = 0;
printf("Case %d:\n", ++cnt);
while(ct < m)
{
for(int i = 0; i < n; i++)
printf("%c", t[i]);
printf("\n");
ct++;
next_permutation(t.begin(), t.begin() + n);
if(t == s)
break;
}
}
return 0;
}

LightOJ 1023 Discovering Permutations 水题的更多相关文章

  1. Lightoj 1023 - Discovering Permutations

    1023 - Discovering Permutations    PDF (English) Statistics Forum Time Limit: 0.5 second(s) Memory L ...

  2. LightOJ 1248 Dice (III) (水题,期望DP)

    题意:给出一个n面的色子,问看到每个面的投掷次数期望是多少. 析:这个题很水啊,就是他解释样例解释的太...我鄙视他,,,,, dp[i] 表示 已经看到 i 面的期望是多少,然后两种选择一种是看到新 ...

  3. lightoj 1020 (博弈水题)

    lightoj 1020 A Childhood Game 链接:http://lightoj.com/volume_showproblem.php?problem=1020 题意:一堆石子有 m 个 ...

  4. 二分--LIGHTOJ 1088查找区间(水题)

    #include <iostream> #include <cstdio> #include <cmath> using namespace std; const ...

  5. LightOJ 1214 Large Division 水题

    java有大数模板 import java.util.Scanner; import java.math.*; public class Main { public static void main( ...

  6. LightOJ 1220 Mysterious Bacteria 水题

    暴力就行了,找出素因子,正的最多是30,然后负的最多是31(这一点wa了一次) #include <cstdio> #include <iostream> #include & ...

  7. lightoj 1010 (水题,找规律)

    lightoj 1010 Knights in Chessboard 链接:http://lightoj.com/volume_showproblem.php?problem=1010 题意:国际象棋 ...

  8. LightOJ 1166 Old Sorting 置换群 或 贪心 水题

    LINK 题意:给出1~n数字的排列,求变为递增有序的最小交换次数 思路:水题.数据给的很小怎么搞都可以.由于坐标和数字都是1~n,所以我使用置换群求循环节个数和长度的方法. /** @Date : ...

  9. LightOJ 1065 - Number Sequence 矩阵快速幂水题

    http://www.lightoj.com/volume_showproblem.php?problem=1065 题意:给出递推式f(0) = a, f(1) = b, f(n) = f(n - ...

随机推荐

  1. HADOOP docker(八):hadoop本地库

    前言2. Native Hadoop Library3. 使用本地库4. 本地库组件5. 支持的平台6. 下载7. 编译8. 运行时观察9. 检查本地库10. 如果共享本地库 小伙伴还记得每次启动hd ...

  2. RedHat/CentOS利用iso镜像做本地yum源

    在这里用iso或者光盘做本地yum源的方法是差不多的,只是用光盘的话Linux系统会自动挂载,用iso镜像的或需要手动挂载,这里就说挂载iso的方法吧. (1) 创建iso存放目录和挂载目录 mkdi ...

  3. POJ 3525/UVA 1396 Most Distant Point from the Sea(二分+半平面交)

    Description The main land of Japan called Honshu is an island surrounded by the sea. In such an isla ...

  4. POJ 3714 Raid(计算几何の最近点对)

    Description After successive failures in the battles against the Union, the Empire retreated to its ...

  5. 2017秋软工1 - 本周PSP

    1.本周PSP 2. 本周PSP饼状图 3. 本周进度条 4. 累计进度图

  6. vim编辑器配置及常用命令

    最近工作不安分, 没有了刚入行时候的锐气, 不知道什么时候开始懈怠起来, 周末在电脑旁边看新闻, 搞笑图片, 追美剧, 一坐就是一天, 很是空虚. 我需要摆脱这种状态, 正好想学习一下安卓底层, An ...

  7. ACM 第十五天

    计算几何基础 练习题 C - Wasted Time Mr. Scrooge, a very busy man, decided to count the time he wastes on all ...

  8. 【week2】 词频统计第一次更新

    词频统计: 对每个功能预计时间: 功能 预计(min) 实际(min) 数据流读入 20 40 正则规范字符串 15 20 排序 30 45 输出 20 30 其他   25 词频统计psp 日期 类 ...

  9. hibernate.cfg.xml的详细解释

    <!--标准的XML文件的起始行,version='1.0'表明XML的版本,encoding='gb2312'表明XML文件的编码方式-->                    < ...

  10. BZOJ 1040 骑士(环套树DP)

    如果m=n-1,显然这就是一个经典的树形dp. 现在是m=n,这是一个环套树森林,破掉这个环后,就成了一个树,那么这条破开的边连接的两个顶点不能同时选择.我们可以对这两个点进行两次树形DP根不选的情况 ...