http://www.bnuoj.com/bnuoj/problem_show.php?pid=10792

被诅咒的代码

Time Limit: 1000ms
Memory Limit: 65536KB
 
64-bit integer IO format: %lld      Java class name: Main
Font Size: + -
Type:  
None
 
Graph Theory
 
    2-SAT
 
    Articulation/Bridge/Biconnected Component
 
    Cycles/Topological Sorting/Strongly Connected Component
 
    Shortest Path
 
        Bellman Ford
 
        Dijkstra/Floyd Warshall
 
    Euler Trail/Circuit
 
    Heavy-Light Decomposition
 
    Minimum Spanning Tree
 
    Stable Marriage Problem
 
    Trees
 
    Directed Minimum Spanning Tree
 
    Flow/Matching
 
        Graph Matching
 
            Bipartite Matching
 
            Hopcroft–Karp Bipartite Matching
 
            Weighted Bipartite Matching/Hungarian Algorithm
 
        Flow
 
            Max Flow/Min Cut
 
            Min Cost Max Flow
 
DFS-like
 
    Backtracking with Pruning/Branch and Bound
 
    Basic Recursion
 
    IDA* Search
 
    Parsing/Grammar
 
    Breadth First Search/Depth First Search
 
    Advanced Search Techniques
 
        Binary Search/Bisection
 
        Ternary Search
 
Geometry
 
    Basic Geometry
 
    Computational Geometry
 
    Convex Hull
 
    Pick's Theorem
 
Game Theory
 
    Green Hackenbush/Colon Principle/Fusion Principle
 
    Nim
 
    Sprague-Grundy Number
 
Matrix
 
    Gaussian Elimination
 
    Matrix Exponentiation
 
Data Structures
 
    Basic Data Structures
 
    Binary Indexed Tree
 
    Binary Search Tree
 
    Hashing
 
    Orthogonal Range Search
 
    Range Minimum Query/Lowest Common Ancestor
 
    Segment Tree/Interval Tree
 
    Trie Tree
 
    Sorting
 
    Disjoint Set
 
String
 
    Aho Corasick
 
    Knuth-Morris-Pratt
 
    Suffix Array/Suffix Tree
 
Math
 
    Basic Math
 
    Big Integer Arithmetic
 
    Number Theory
 
        Chinese Remainder Theorem
 
        Extended Euclid
 
        Inclusion/Exclusion
 
        Modular Arithmetic
 
    Combinatorics
 
        Group Theory/Burnside's lemma
 
        Counting
 
    Probability/Expected Value
 
Others
 
    Tricky
 
    Hardest
 
    Unusual
 
    Brute Force
 
    Implementation
 
    Constructive Algorithms
 
    Two Pointer
 
    Bitmask
 
    Beginner
 
    Discrete Logarithm/Shank's Baby-step Giant-step Algorithm
 
    Greedy
 
    Divide and Conquer
 
Dynamic Programming
                   Tag it!
程序猿是一种近几十年来出现的新物种,是工业革命的产物。英文(Programmer Monkey)是一种非常特殊的、可以从事程序开发、维护的动物。一般分为程序设计猿和程序编码猿,但两者的界限并不非常清楚,都可以进行开发、维护工作,特别是在中国,而且最重要的一点,二者都是一种非常悲剧的存在。
最新的研究显示,程序猿有一大特点:易猝死。最近经常有某只程序猿猝死的消息直接占满题目作者人人首页的情况出现……
有一天,一只程序猿写了如下一段代码:
然后,突了个然!他就猝死了- -||
现在他剩下的工作被交给了你,请你写一个代码,能输出与这段代码相同的结果。(由于原先的代码遭到了程序猿的诅咒,直接提交他的代码或只是对他的代码进行小的改动是无法通过的……)

Input

第一行为一个整数T(T<=100)表示数据组数,接下来的T行每行一个整数n(n<109)。
 

Output

对于每组数据,输出一个数表示原先代码输出的结果。
 

Sample Input

3
1
2
3
 

Sample Output

1
3
6
 

Source

Author

temperlsyer
 #include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std; int a[]={,,,,,,,,,}; int pow_sum2(int a,int n,int m)
{
int temp=;
a=a%m;
while(n)
{
if(n&)
{
temp=temp+a;
if(temp>=m)
temp=temp-m;
}
a<<=;
if(a>=m) a=a-m;
n>>=; }
return temp;
} int main()
{
int t,n;
while(scanf("%d",&t)>)
{
while(t--)
{
scanf("%d",&n);
int hxl=n/;
int tom=n%;
// if(tom==0) tom=1;
int sum=pow_sum2(,hxl,);
sum=(sum+a[tom])%;
printf("%d\n",sum);
}
}
return ;
}
 

最新文章

  1. jenkins添加git源码目录时报Error performing command错误
  2. 导入excel错误:外部表不是预期的格式 解决方案
  3. MFC Initinstance中DoModal()返回-1
  4. CAT XQX --- 省市三级级联实现说明
  5. 分享一款简洁的jQuery轮播源码
  6. FPGA设计—UVM验证篇 Hello world
  7. 使用win8.1 x64 office2010 php 使用 pdo_odbc 连接excel失败的问题
  8. 最全的C#图片处理帮助类ImageHelper
  9. 小星星的php
  10. EF实体的部分更新
  11. 如何选择 Apache Tomcat 与 JDK 版本
  12. Django合集
  13. Java8的Stream语法详解(转载)
  14. 初始mvc4(一) 新建项目
  15. secp256k1如何使用
  16. 【文件】使用jacob将word转换成pdf格式
  17. markdownpad2-注册码-2017-02-23
  18. RN 调用安卓的原生方法(实现Toast效果)
  19. java调用微信扫一扫
  20. 两个项目之间通过 RestTemplate 进行调用

热门文章

  1. C#控制台输出退格实现变换闪烁的字符效果
  2. 【Hadoop &amp; Ecilpse】Exception in thread &quot;main&quot; org.apache.hadoop.security.AccessControlException: Permission denied: user=bruce, access=WRITE, inode=&quot;/out2/_temporary/0&quot;:atguigu:supergroup:drwxr-xr-x
  3. 1.需要对txt存放的测试数据做去重处理,代码如下
  4. lspci
  5. 洛谷P2051 [AHOI2009]中国象棋(dp)
  6. Mac 10.12搭建OpenVPN服务器以及客户端的使用
  7. 连接Git@OSC操作步骤
  8. 使用grunt搭建自动化的web前端开发环境
  9. 修改docker的port端口映射
  10. maven install时报错 Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test)