SDUT 周赛 神奇的树(简单题 注意数据类型的溢出 )
神奇的树
Time Limit: 1000ms Memory limit: 65536K 有疑问?点这里^_^
题目描述
输入
输出
示例输入
1 5
3 6
示例输出
No
Yes
#include <iostream>
#include <string>
#include <string.h>
#include <stdio.h>
#include <algorithm> using namespace std; int main()
{
bool f[200006];
long long x;
int m; while(scanf("%d %d", &x, &m)!=EOF)
{
memset(f, false, sizeof(f));
int flag;
while(f[x]==false && x!=0)
{
f[x]=true;
x=x*2;
x=x%m;
}
if(x==0)
{
cout<<"Yes\n";
}
if(f[x]==true)
{
cout<<"No\n";
}
}
return 0;
}
SDUT 周赛 神奇的树(简单题 注意数据类型的溢出 )的更多相关文章
- 【BZOJ2683】简单题 [分治][树状数组]
简单题 Time Limit: 50 Sec Memory Limit: 128 MB[Submit][Status][Discuss] Description 你有一个N*N的棋盘,每个格子内有一 ...
- BZOJ_2683_简单题&&BZOJ_1176_[Balkan2007]Mokia_CDQ分治+树状数组
BZOJ_2683_简单题&&BZOJ_1176_[Balkan2007]Mokia_CDQ分治+树状数组 Description 维护一个W*W的矩阵,初始值均为S.每次操作可以增加 ...
- 树状数组例题-数星星,简单题easy,校门外的树2,清点人数
[例1]数星星 天空中有一些星星,这些星星都在不同的位置,每个星星都有个坐标,如果一个星星的左下方(包括正左和正下)有k颗星星,就说这颗星星是k级的. 比如,上图中,星星5是3级的(1,2,4在其左下 ...
- 「CQOI2006」简单题 线段树
「CQOI2006」简单题 线段树 水.区间修改,单点查询.用线段树维护区间\([L,R]\)内的所有\(1\)的个数,懒标记表示为当前区间是否需要反转(相对于区间当前状态),下方标记时懒标记取反即可 ...
- P5057 [CQOI2006]简单题(线段树)
果然简单题,5分钟紫题++ 代码 #include <cstdio> #include <algorithm> #include <cstring> using n ...
- 洛谷P5057 [CQOI2006]简单题(线段树)
题意 题目链接 Sol 紫色的线段树板子题??... #include<iostream> #include<cstdio> #include<cmath> usi ...
- [CQOI 2006]线段树之简单题
Description 有一个n个元素的数组,每个元素初始均为0.有m条指令,要么让其中一段连续序列数字反转--0变1,1变0(操作1),要么询问某个元素的值(操作2).例如当n=20时,10条指令如 ...
- BZOJ 2683: 简单题
2683: 简单题 Time Limit: 50 Sec Memory Limit: 128 MBSubmit: 913 Solved: 379[Submit][Status][Discuss] ...
- 【BZOJ-1176&2683】Mokia&简单题 CDQ分治
1176: [Balkan2007]Mokia Time Limit: 30 Sec Memory Limit: 162 MBSubmit: 1854 Solved: 821[Submit][St ...
随机推荐
- OI 数论整理
1.素数: 质数(prime number)又称素数,有无限个.一个大于1的自然数,除了1和它本身外,不能被其他自然数整除,换句话说就是该数除了1和它本身以外不再有其他的因数;否则称为合数. 2016 ...
- Cucumber Vs RobotFramework
I asked this same question a little over a year ago on this list when we were at your stage. Before ...
- hdu 4960 记忆化搜索 DP
Another OCD Patient Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Ot ...
- 自定义Navigation按钮及Title
导航栏自带的按钮,时常不能满足要求,所以深深需要进行各种定制. 写一个UINavigationItem的category // UINavigationItem+CB_ChangeButton.h ...
- csv文件导出
参考博客:http://www.cnblogs.com/mingforyou/p/4103132.html 导入jar包javacsv.jar 链接:http://pan.baidu.com/s/1i ...
- 关于xshell无法连接到centos的问题
1.xshell无法连接到centos:拒绝连接(无线网) 在xshell ping centos出现: 解决方法: 1. 2.重启下网卡: [root@localhost ~]# /etc/init ...
- T3187 队列练习3 codevs
http://codevs.cn/problem/3187/ 题目描述 Description 比起第一题,本题加了另外一个操作,访问队头元素(编号3,保证访问队头元素时或出队时队不为空),现在给出这 ...
- ROS之:log文件
1.log文件的位置: log file: /home/wang/.ros/log/... 1)显示隐藏文件(.文件),Ctrl+h 2)该文件夹下的文件夹是运行launch文件产生的 3)该文件夹下 ...
- android DatePicker使用
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools=&q ...
- android 加一个按钮,退出程序
package com.example.yanlei.yl; import android.graphics.Color; import android.support.v7.app.AppCompa ...