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/Others)
Total Submission(s): 346 Accepted Submission(s): 167
We have two integer n (0<=n<=104 ) , t(0<=t<=105) in each row.
When n==-1 and t==-1 mean the end of input.
#include <bits/stdc++.h>
using namespace std;
int cur = ,n,m,d[];
int solve(int x) {
int a[] = {};
cur = ;
while(x) {
a[cur^] += x%;
x /= ;
cur ^= ;
}
if(cur&) swap(d[],d[]);
d[] += a[];
d[] += a[];
return d[] + d[];
}
int main() {
int cs = ;
while(scanf("%d%d",&n,&m),(~n) && (~m)) {
d[] = d[] = ;
for(int i = ; i <= m; ++i) n = solve(n);
printf("Case #%d: %s\n",cs++,abs(d[]-d[])%?"No":"Yes");
}
return ;
}
2015 Multi-University Training Contest 7 hdu 5373 The shortest problem的更多相关文章
- hdu 5373 The shortest problem(杭电多校赛第七场)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5373 The shortest problem Time Limit: 3000/1500 MS (J ...
- 2015 Multi-University Training Contest 7 hdu 5371 Hotaru's problem
Hotaru's problem Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) ...
- HDU 5373 The shortest problem (数学)
题意:给定两个数的n和m,有一种操作,把 n 的各位数字加起来放到 n后面形成一个新数n,问重复 m 次所得的数能否整除 11. 析:这个题首先要知道一个规律奇数位的和减去偶数位的和能被11整除的数字 ...
- 2019 Multi-University Training Contest 2: 1010 Just Skip The Problem 自闭记
2019 Multi-University Training Contest 2: 1010 Just Skip The Problem 自闭记 题意 多测.每次给你一个数\(n\),你可以同时问无数 ...
- 同余模定理 HDOJ 5373 The shortest problem
题目传送门 /* 题意:题目讲的很清楚:When n=123 and t=3 then we can get 123->1236->123612->12361215.要求t次操作后, ...
- 2015 Multi-University Training Contest 8 hdu 5390 tree
tree Time Limit: 8000ms Memory Limit: 262144KB This problem will be judged on HDU. Original ID: 5390 ...
- 2015 Multi-University Training Contest 8 hdu 5383 Yu-Gi-Oh!
Yu-Gi-Oh! Time Limit: 2000ms Memory Limit: 65536KB This problem will be judged on HDU. Original ID: ...
- 2015 Multi-University Training Contest 8 hdu 5385 The path
The path Time Limit: 2000ms Memory Limit: 65536KB This problem will be judged on HDU. Original ID: 5 ...
- 2015 Multi-University Training Contest 3 hdu 5324 Boring Class
Boring Class Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Tota ...
随机推荐
- C#中的DES加密
publicstaticstringEncryptString(string sInputString,string sKey,string sIV) { try { byte[] data =Enc ...
- 洛谷——P1030 求先序排列
https://www.luogu.org/problem/show?pid=1030#sub 题目描述 给出一棵二叉树的中序与后序排列.求出它的先序排列.(约定树结点用不同的大写字母表示,长度< ...
- 关于excel导出
转载自:https://blog.csdn.net/ljj_9/article/details/50395688 //一个excel表格: HSSFWorkbook wb = new HSSFWork ...
- 3D数学读书笔记——矩阵进阶
本系列文章由birdlove1987编写,转载请注明出处. 文章链接:http://blog.csdn.net/zhurui_idea/article/details/25242725 最终要学习矩阵 ...
- jenkins下载
前置条件:需要有java环境的jdk 一.安装使用 下载地址:https://jenkins-ci.org/content/thank-you-downloading-windows-installe ...
- reactjs simple text editor
import React, { Component } from 'react' import PubSub from 'pubsub' import GlobalVars from 'globalV ...
- Uva 12012 Detection of Extraterrestrial 求循环节个数为1-n的最长子串长度 KMP
题目链接:option=com_onlinejudge&Itemid=8&page=show_problem&problem=3163">点击打开链接 题意: ...
- zzulioj--1613--少活一年?(稍微有点坑,水!)
1613: 少活一年? Time Limit: 1 Sec Memory Limit: 128 MB Submit: 344 Solved: 70 SubmitStatusWeb Board De ...
- 敏捷开发 —— TDD(测试驱动开发)
测试驱动开发 TDD(Test-Driven Development)是敏捷开发的一项核心实践,同时也是一种设计技术和方法. 既然是测试驱动,便是测试,测试用例先行: 首先编写好测试用例,期待值,实际 ...
- 学习 shell —— 条件判断 if 的参数
1. 文件判断表达式 -e filename:如果 filename 存在(exist),则为真: -d filename:如果 filename 为目录(directory),则为真: -f fil ...