C - Will It Stop?
Time Limit: 20 Sec

Memory Limit: 256 MB

题目连接

http://acm.hust.edu.cn/vjudge/contest/view.action?cid=87794#problem/C

Description

Byteasar was wandering around the library of the University of Warsaw and at one of its facades he noticed a piece of a program with an inscription “Will it stop?”. The question seemed interesting, so Byteasar tried to tackle it after returning home. Unfortunately, when he was writing down the piece of code he made a mistake and noted:
 
while n > 1 do if n mod 2 = 0 then n := n=2 else n := 3 · n + 3
Byteasar is now trying to figure out, for which initial values of the variable n the program he wrote down stops. We assume that the variable n has an unbounded size, i.e., it may attain arbitrarily large values.
 
 

Input

The first and only line of input contains one integer n (2 ¬ n ¬ 1014).

Output

In the first and only line of output you should write a single word TAK (i.e., yes in Polish), if the program stops for the given value of n, or NIE (no in Polish) otherwise.

Sample Input

4

Sample Output

TAK

HINT

题意

给你一个数,然后问你这个数组是否会无限循环

题解

暴力10000000次,然后看看就吼了

代码:

//qscqesze
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <queue>
#include <typeinfo>
#include <fstream>
#include <map>
#include <stack>
typedef long long ll;
using namespace std;
//freopen("D.in","r",stdin);
//freopen("D.out","w",stdout);
#define sspeed ios_base::sync_with_stdio(0);cin.tie(0)
#define maxn 5000
#define mod 10007
#define eps 1e-9
int Num;
//const int inf=0x7fffffff; //нчоч╢С
const int inf=0x3f3f3f3f;
inline ll read()
{
ll x=,f=;char ch=getchar();
while(ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
}
//************************************************************************************** int main()
{
unsigned long long n;
cin>>n;
int tot=;
while(n>)
{
if(n%==)
n=n/;
else
n=*n+;
tot++;
if(tot>)
{
cout<<"NIE"<<endl;
return ;
}
}
cout<<"TAK"<<endl; }

Codeforces Gym 100523C C - Will It Stop? 水题的更多相关文章

  1. codeforces Gym 100187L L. Ministry of Truth 水题

    L. Ministry of Truth Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100187/p ...

  2. Codeforces Gym 100610 Problem E. Explicit Formula 水题

    Problem E. Explicit Formula Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/10 ...

  3. Codeforces Round #185 (Div. 2) B. Archer 水题

    B. Archer Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/312/problem/B D ...

  4. Educational Codeforces Round 14 A. Fashion in Berland 水题

    A. Fashion in Berland 题目连接: http://www.codeforces.com/contest/691/problem/A Description According to ...

  5. Codeforces Round #360 (Div. 2) A. Opponents 水题

    A. Opponents 题目连接: http://www.codeforces.com/contest/688/problem/A Description Arya has n opponents ...

  6. Codeforces Round #190 (Div. 2) 水果俩水题

    后天考试,今天做题,我真佩服自己... 这次又只A俩水题... orz各路神犇... 话说这次模拟题挺多... 半个多小时把前面俩水题做完,然后卡C,和往常一样,题目看懂做不出来... A: 算是模拟 ...

  7. Codeforces Round #256 (Div. 2/A)/Codeforces448A_Rewards(水题)解题报告

    对于这道水题本人觉得应该应用贪心算法来解这道题: 下面就贴出本人的代码吧: #include<cstdio> #include<iostream> using namespac ...

  8. Codeforces Gym 100342H Problem H. Hard Test 构造题,卡迪杰斯特拉

    Problem H. Hard TestTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100342/at ...

  9. Gym 101873K - You Are Fired - [贪心水题]

    题目链接:http://codeforces.com/gym/101873/problem/K 题意: 现在给出 $n(1 \le n \le 1e4)$ 个员工,最多可以裁员 $k$ 人,名字为 $ ...

随机推荐

  1. js函数——倒计时模块+无缝滚动

    倒计时 效果: 代码: <!DOCTYPE html> <html lang="en"> <head> <meta charset=&qu ...

  2. JDBC连接工厂类

       看到有些书上数据库连接提供两个工厂类,一个连接工厂类一个关闭工厂类,并且关闭工厂类写了多种重载形式,感觉没有必要,这样写比较简洁一些. /** * 抽象出的连接工厂类,提供连接数据库和关闭连接的 ...

  3. 帮同事写了几行代码,在 安装/卸载 程序里 注册/卸载 OCX控件

    写了个小控制台程序,这个程序用来注册 / 卸载OCX控件,用在Inno Setup做的安装卸载程序里. #include "stdafx.h" #include <windo ...

  4. 如何在 Windows Azure 的虚拟机 ubuntu 上面安装和配置 openVPN(三)

    第三步:安装openVPN 请打开 ubuntu 官方文档.然后,从上到下,按照步骤,输入执行命令.大家只需要执行到 First trouble shooting 之前即可. 不要怕麻烦,仔细读,一步 ...

  5. bzoj 3275 Number(最小割)

    [题意] 给定n个数,要求选出一些数满足 1.存在c,a*a+b*b=c*c 2.gcd(a,b)=1  使得和最大. [思路] 二分图的最大权独立集(可以这么叫么QAQ 先拆点,对于不满足条件的两个 ...

  6. iOS Development Learning 13Nov

    关注了关东升老师在博客园的iOS开发博客. 在使用能力课堂观看智捷课堂的iOS8开发视频教程.观看到Part1 课时3 Xcode中的iOS工程模板

  7. AHOI2013 Round2 Day1 简要题解

    第一题,好吧这是个dp.(搜素也能在BZOJ上卡过). 第二题,BFS搜索碰到的立方体面数,智硬没有想到... 第三题,其实一看就有思路,但关键是求x坐标不交的矩形对数+y坐标不交的矩形对数 - x, ...

  8. http 名词解释

    get.post.put.delete的安全性和幂等性 安全性:指的是对资料是否有破坏性的操作 幂等性:指的是对资源操作时,数据是一致性.

  9. delphi debug release区别是什么?

    1. 基础知识介绍: Debug编译:是为了便于程序调试,所以目标代码里附加有许多额外的东西.Release编译:是产品可作为正式拷贝发布了,已经不需要那些仅为调试而编译进去东西. (在 Releas ...

  10. PC问题-可以PING通IP,PING名字不通,可以远程,但不能访问共享文件夹?

    问题现象:可以PING通IP,PING名字不通,可以远程,但不能访问共享文件夹? 问题原因:目标主机中NetLogon服务未启动. 问题处理:远程打开目标主机,“我的电脑-管理-服务-启动(改为自动) ...