bnu 被诅咒的代码
2024-09-30 06:22:39
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!
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 ;
}
最新文章
- jenkins添加git源码目录时报Error performing command错误
- 导入excel错误:外部表不是预期的格式 解决方案
- MFC Initinstance中DoModal()返回-1
- CAT XQX --- 省市三级级联实现说明
- 分享一款简洁的jQuery轮播源码
- FPGA设计—UVM验证篇 Hello world
- 使用win8.1 x64 office2010 php 使用 pdo_odbc 连接excel失败的问题
- 最全的C#图片处理帮助类ImageHelper
- 小星星的php
- EF实体的部分更新
- 如何选择 Apache Tomcat 与 JDK 版本
- Django合集
- Java8的Stream语法详解(转载)
- 初始mvc4(一) 新建项目
- secp256k1如何使用
- 【文件】使用jacob将word转换成pdf格式
- markdownpad2-注册码-2017-02-23
- RN 调用安卓的原生方法(实现Toast效果)
- java调用微信扫一扫
- 两个项目之间通过 RestTemplate 进行调用
热门文章
- C#控制台输出退格实现变换闪烁的字符效果
- 【Hadoop &; Ecilpse】Exception in thread ";main"; org.apache.hadoop.security.AccessControlException: Permission denied: user=bruce, access=WRITE, inode=";/out2/_temporary/0";:atguigu:supergroup:drwxr-xr-x
- 1.需要对txt存放的测试数据做去重处理,代码如下
- lspci
- 洛谷P2051 [AHOI2009]中国象棋(dp)
- Mac 10.12搭建OpenVPN服务器以及客户端的使用
- 连接Git@OSC操作步骤
- 使用grunt搭建自动化的web前端开发环境
- 修改docker的port端口映射
- maven install时报错 Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test)