规律题。我自己写的规律对长度为2的要特判,wa一万次。。。

规律题目,容易错的反而是数据小的时候,得长记性。

题解:规律 先是1~n 然后1~n-2 n-1  1~n-2 n 交替出现

比如当n=4 的时候 1 2 3 4  1 2 3 1 2 4  1 2 3  1 2 4 ......

AC代码:

#include <cstdio>
#include <iostream>
using namespace std;
typedef long long ll;
int main()
{
int Case=;
ll n,m;
while(cin>>n>>m)
{
if(n==)// 注意对2 特判。
{
if(m%) printf("Case #%d: %lld\n",Case,(ll));
else printf("Case #%d: %lld\n",Case,(ll)); Case++;
continue;
}
if(m<=n)
{
printf("Case #%d: %lld\n",Case,m);
Case++;
continue;
}
ll temp=m-n;
ll ret=temp/(n-);
ll zz=temp%(n-);
if(zz!=)
{
printf("Case #%d: %lld\n",Case,zz);
}
else
{
if(ret%)
{
printf("Case #%d: %lld\n",Case,n-);
}
else printf("Case #%d: %lld\n",Case,n);
}
Case++;
} }

hdu 6043 KazaQ's Socks的更多相关文章

  1. HDU 6043 - KazaQ's Socks | 2017 Multi-University Training Contest 1

    /* HDU 6043 - KazaQ's Socks [ 找规律 ] | 2017 Multi-University Training Contest 1 题意: 一共 n 双袜子编号 1~n,每天 ...

  2. 2017 Multi-University Training Contest - Team 1 1011&&HDU 6043 KazaQ's Socks【规律题,数学,水】

    KazaQ's Socks Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)T ...

  3. HDU 6043 KazaQ's Socks (规律)

    Description KazaQ wears socks everyday. At the beginning, he has nn pairs of socks numbered from 11  ...

  4. 2017ACM暑期多校联合训练 - Team 1 1011 HDU 6043 KazaQ's Socks (找规律)

    题目链接 Problem Description KazaQ wears socks everyday. At the beginning, he has n pairs of socks numbe ...

  5. HDU - 6043 KazaQ's Socks(找规律)

    题意:有n双袜子,编号1到n,放在衣柜里,每天早晨取衣柜中编号最小的袜子穿,晚上将这双袜子放在篮子里,当篮子里有n-1双袜子时,清洗袜子,直到第二天晚上才洗好,并将洗好的袜子重新放回衣柜. 分析:规律 ...

  6. HDU6043 17多校1 KazaQ's Socks 水题

    题目传送:http://acm.hdu.edu.cn/showproblem.php?pid=6043 Problem Description KazaQ wears socks everyday. ...

  7. HDU6043 KazaQ's Socks

    Problem Description KazaQ wears socks everyday. At the beginning, he has n pairs of socks numbered f ...

  8. 杭电 KazaQ's Socks

    KazaQ wears socks everyday. At the beginning, he has n pairs of socks numbered from 1 to n in his cl ...

  9. 【多校联合】(HDU6043)KazaQ's Socks

    [多校联合](HDU6043)KazaQ's Socks 一条纯粹的水题,记录下只是因为自己错的太多而已. 原因在于对数据的细节的把握不佳. 原题 KazaQ's Socks Time Limit: ...

随机推荐

  1. CentOS7.4搭建ftp服务

    1.使用yum安装vsftpd yum install vsftpd -y 2.安装完成后,启动 FTP 服务: service vsftpd start 3.配置ftp权限 目前 FTP 服务登陆允 ...

  2. Promise初尝试

    promise.ts export function showAlert() { console.log("开始调用showAlert"); return new Promise( ...

  3. fastadmin 后台管理中,权限设置,不同管理员,显示不同的数据

    1.https://doc.fastadmin.net/docs/controller.html

  4. lareval重命名created_at和updated_at字段

    lareval重命名created_at和updated_at字段 一.总结 一句话总结: 要改变created_at和updated_at的名称,模型和数据迁移里面都需要改变 在模型中指定数据类型之 ...

  5. LeetCode 搜索旋转排序数组

    假设按照升序排序的数组在预先未知的某个点上进行了旋转. ( 例如,数组 [0,1,2,4,5,6,7] 可能变为 [4,5,6,7,0,1,2] ). 搜索一个给定的目标值,如果数组中存在这个目标值, ...

  6. UML期末复习题——2.7:UML Sequence Diagram

    第七题:顺序图 重要概念: 1. 顺序图的主要介绍,在之前对第5题“系统顺序图”的解析讲解里已经很详细了,在这里只是对部分不全面的内容进行补充. 第五题:系统顺序图&后置条件 http://w ...

  7. 智能指针-共享式shared_ptr

    #include <iostream>#include <string>#include <vector>#include <memory> using ...

  8. img标签替换为mip-img标签的方法

    function replaceMipImages($content){ preg_match_all('/<img (.*?)\>/', $content, $images); if(! ...

  9. dlopen, dlsym今天才刚知道干什么用的,羞死人了

    dlopen, dlsym今天才刚知道干什么用的,羞死人了

  10. Eureka启动报错:Failed to load property source from location 'classpath:/application.yml'

    原因: 将application.yml添加到classpath时, 由于变更了application.yml的编码格式(或许也改变了些代码内容), 而target内的yml文件没有实时更新, 从而导 ...