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 ;
}

最新文章

  1. iOS工作小技巧及填坑记录
  2. Spring 事务注解 错误问题
  3. 关于NPOI
  4. slice,substr和substring的区别
  5. Android学习笔记(二十一)——实战:程序数据共享
  6. databasefactory.createdatabase Web.config 配置关键点提醒
  7. java实现httpclient2
  8. AndroidStudio的一些坑
  9. PDF 补丁丁 0.4.1.839 测试版发布:调整页面留白
  10. jsonp实现跨域访问
  11. C#学习笔记之线程 - 通知Signal
  12. WebView组件的应用
  13. [转]Delphi : keydown与keypress的区别,组合键
  14. .NET基础拾遗(1)类型语法基础和内存管理基础1
  15. iOS 改变导航栏高度
  16. [翻译]编写高性能 .NET 代码 第二章:垃圾回收 基本操作
  17. Hadoop系列007-HDFS客户端操作
  18. 使用Python开发chrome插件
  19. dp乱写2:论dp在不在dp中(但在dp范畴)内的应用
  20. 使用SoapUI 对WebService压力测试

热门文章

  1. openssl进行RSA加解密(C++)
  2. 【题解】POJ3041 Asteroids - 图论 - 二分图匹配
  3. Django文档阅读-Day2
  4. js输入框练习
  5. 高德局部刷新标记点,bug解决
  6. linux下批量删除文件
  7. [Inno Setup] 安装完成后调用函数
  8. How to change the header background color of a QTableView
  9. Spring Boot JPA 中transaction的使用
  10. 【高并发】由InterruptedException异常引发的思考