http://acm.hdu.edu.cn/showproblem.php?pid=5373

思路:按题意来即可。

 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#include <map>
#include <set>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm> using namespace std; #define X first
#define Y second
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(), (a).end()
#define fillchar(a, x) memset(a, x, sizeof(a))
#define copy(a, b) memcpy(a, b, sizeof(a)) typedef long long ll;
typedef pair<int, int> pii;
typedef unsigned long long ull; //#ifndef ONLINE_JUDGE
void RI(vector<int>&a,int n){a.resize(n);for(int i=;i<n;i++)scanf("%d",&a[i]);}
void RI(){}void RI(int&X){scanf("%d",&X);}template<typename...R>
void RI(int&f,R&...r){RI(f);RI(r...);}void RI(int*p,int*q){int d=p<q?:-;
while(p!=q){scanf("%d",p);p+=d;}}void print(){cout<<endl;}template<typename T>
void print(const T t){cout<<t<<endl;}template<typename F,typename...R>
void print(const F f,const R...r){cout<<f<<", ";print(r...);}template<typename T>
void print(T*p, T*q){int d=p<q?:-;while(p!=q){cout<<*p<<", ";p+=d;}cout<<endl;}
//#endif
template<typename T>bool umax(T&a, const T&b){return b<=a?false:(a=b,true);}
template<typename T>bool umin(T&a, const T&b){return b>=a?false:(a=b,true);}
template<typename T>
void V2A(T a[],const vector<T>&b){for(int i=;i<b.size();i++)a[i]=b[i];}
template<typename T>
void A2V(vector<T>&a,const T b[]){for(int i=;i<a.size();i++)a[i]=b[i];} const double PI = acos(-1.0);
const int INF = 1e9 + ;
const double EPS = 1e-8; /* -------------------------------------------------------------------------------- */ int get(int sum, int &x, int &mark) {
if (sum == ) {
x = ;
mark = ;
return ;
}
mark = ;
x = ;
int ans = ;
while (sum) {
mark ^= ;
if (mark) ans += sum % ;
else ans -= sum % ;
x += sum % ;
sum /= ;
}
return ans;
} int main() {
#ifndef ONLINE_JUDGE
freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
#endif // ONLINE_JUDGE
int n, t, cas = ;
while (cin >> n >> t, n != - && t != -) {
int mark, sum, ans;
ans = get(n, sum, mark);
for (int i = ; i < t; i ++) {
int x, buf = get(sum, x, mark);
if (mark) ans = -ans + buf;
else ans = ans + buf;
sum += x;
}
printf("Case #%d: %s\n", ++ cas, ans % ? "No" : "Yes");
}
return ;
}

[hdu5373 The shortest problem]模拟的更多相关文章

  1. HDU-5373 The shortest problem

    The shortest problem http://acm.hdu.edu.cn/showproblem.php?pid=5373 Time Limit: 3000/1500 MS (Java/O ...

  2. HDU5373 The shortest problem (YY)

    http://acm.hdu.edu.cn/showproblem.php?pid=5373 YY题,模拟下计算过程就好了,计算中并不要保存实际数(这个数会非常大),只要保存到目前为止的数字位上的和 ...

  3. HDU 5373(2015多校7)-The shortest problem(模拟%11)

    题目地址:pid=5373">HDU 5373 题意:给你一个数n和操作次数t,每次操作将n的各位数之和求出来放在n的末尾形成新的n,问t次操作后得到的n能否够被11整除. 思路:就是 ...

  4. 同余模定理 HDOJ 5373 The shortest problem

    题目传送门 /* 题意:题目讲的很清楚:When n=123 and t=3 then we can get 123->1236->123612->12361215.要求t次操作后, ...

  5. The shortest problem

    The shortest problem Time Limit: 3000/1500 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others ...

  6. hdu 5373 The shortest problem(杭电多校赛第七场)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5373 The shortest problem Time Limit: 3000/1500 MS (J ...

  7. 2015 Multi-University Training Contest 7 hdu 5373 The shortest problem

    The shortest problem Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Oth ...

  8. The shortest problem(hdu,多校

    The shortest problem Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Oth ...

  9. hdu_5832_A water problem(模拟)

    题目链接:hdu_5832_A water problem 这是一个惨痛的教训,想这种这么大的大数肯定就是找个规律模拟一下. 然而我们队还写JAVA,用大数艹了13发罚时,真是TM智障了. #incl ...

随机推荐

  1. .Net Core Send Email

    1.安装Nuget包MailKit,引用命名空间. using MailKit.Net.Smtp; using MimeKit; 注意:引用MailKit对应最新版本 2.定义收发地址和标题 Mime ...

  2. 2. Git-命令行-删除本地和远程分支

    命令行方式 Git Bash: 切换到要操作的项目文件夹 命令行 : $ cd <ProjectPath> 查看项目的分支们(包括本地和远程) 命令行 : $ git branch -a ...

  3. Laravel 5.7 RCE (CVE-2019-9081)

    Laravel 代码审计 环境搭建 Laravel 5.7 文档 : https://learnku.com/docs/laravel/5.7/installation/2242 Composer 下 ...

  4. pytorch seq2seq模型中加入teacher_forcing机制

    在循环内加的teacher forcing机制,这种为目标确定的时候,可以这样加. 目标不确定,需要在循环外加. decoder.py 中的修改 """ 实现解码器 &q ...

  5. ES6系列-什么是ES6?新手应该怎么理解

    ECMAScript 是什么 很多初学者都很困惑,ECMAScript是什么?它跟JavaScript有什么关系? 大家注意到了吗?从题目中我们就可以看出来了,ECMAScript是JavaScrip ...

  6. ubuntu下载速度慢的解决办法--修改下载源

    操作:https://blog.csdn.net/qq_24326765/article/details/81916222 推荐源:https://blog.csdn.net/qq_36328643/ ...

  7. vagrant + 宝塔 环境搭建遇到的一些问题

    1.js时间戳单位为毫秒,php时间戳为秒. 2.tp里的where()方法如果where("id=".$id)不能用的话就用数组形式的:where(array("id& ...

  8. Python 如何实现 单实例

    出处:https://stackoverflow.com/questions/380870/make-sure-only-a-single-instance-of-a-program-is-runni ...

  9. CodeForces 674C Levels and Regions

    #include<bits/stdc++.h> using namespace std; const int maxn=2e5+5; int N,K,head,tair; int q[ma ...

  10. 【Linux网络基础】网络子网划分基础知识(IP地址,子网)

    一. IP地址分类与子网划分基础 1. 什么是IP地址? 常见的ip地址版本为ipv4, ipv6 32位 4 * 8=32位. 32位二进制数字序列组成的数字序列   点分十进制 采用点将32位数字 ...