bnu 被诅咒的代码
http://www.bnuoj.com/bnuoj/problem_show.php?pid=10792
被诅咒的代码
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!
Input
Output
Sample Input
3
1
2
3
Sample Output
1
3
6
Source
Author
#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 ;
}
bnu 被诅咒的代码的更多相关文章
- Git hub加载慢?下载慢?浏览慢?几个小技巧让你一键起飞!
记得,那是一个风和日丽,艳阳高照的夜晚,只因为当初的一次回眸,于是便决然走向了程序员的道路,从此,CV大法心中记,代码伴我身. 这一天,正当我打开电脑准备开开心心的使用CV大法完成任务的时候,却恼人的 ...
- 诅咒JavaScript之----ArcGIS JavaScript 点聚合 ClusterLayer
对一个之前一直做winForm的 菜鸟来说,突然接触这么神奇的语言,基本上每天都会诅咒一下这门神奇的语言. 最近做了一个小网站,底图用的是天地图的服务,用ArcGIS JavaScript提供的一些G ...
- Rails 5 Test Prescriptions 最后一章,如何测试继承下来的代码,legacy code
Set expectations 你不可能把一个老旧的代码野兽只用一晚就转变成优雅的奇迹marvel.你需要如下做法: 让自己有好的状态,用15分钟挥舞拳头诅咒之前的程序员 开始工作,这个codeba ...
- Html5游戏开发-145行代码完成一个RPG小Demo
lufy前辈写过<[代码艺术]17行代码的贪吃蛇小游戏>一文,忽悠了不少求知的兄弟进去阅读,阅读量当然是相当的大.今天我不仿也搞一个这样的教程,目地不在于忽悠人,而在于帮助他人. 先看de ...
- 2016级算法第二次上机-A.画个圈圈诅咒你
890 画个圈圈诅咒你 思路 简单题.题目中的圆并没有什么实际作用,简化成线段重合问题会更好理解些. 暴力解法:使用双重for循环会T到想哭,记住最直接的方法一般是过不了题的. 解法一:二分查找.空间 ...
- BNU 34990 Justice String 2014 ACM-ICPC Beijing Invitational Programming Contest
题目链接:http://acm.bnu.edu.cn/bnuoj/problem_show.php?pid=34990 DEBUG了非常久,还是legal的推断函数写错了... 此题做法.枚举Stri ...
- 日期格式代码出现两次的错误 ORA-01810
错误的原因是使用了两次MM . 一.Oracle中使用to_date()时格式化日期需要注意格式码 如:select to_date('2005-01-01 11:11:21','yyyy-MM-dd ...
- 可爱的豆子——使用Beans思想让Python代码更易维护
title: 可爱的豆子--使用Beans思想让Python代码更易维护 toc: false comments: true date: 2016-06-19 21:43:33 tags: [Pyth ...
- iOS代码规范(OC和Swift)
下面说下iOS的代码规范问题,如果大家觉得还不错,可以直接用到项目中,有不同意见 可以在下面讨论下. 相信很多人工作中最烦的就是代码不规范,命名不规范,曾经见过一个VC里有3个按钮被命名为button ...
随机推荐
- MySQL之LIMIT用法
http://blog.163.com/niuxiangshan@126/blog/static/17059659520101081058299/ 看的人家的 mysql支持limitselect * ...
- mysql分表分库选型
三个方向: 一.应用中自己实现,可直连数据库,自己实现因目前使用的Mybatis框架可以使用两种做法: 1.在SQL中直接分表逻辑,我查了一下代码中的sql,发现join的千姿百态,不大动这些sql这 ...
- mysql中字符串1.1/1.2/1.2.2/1.2.5排序问题
1.创建查询函数:(split_pid为函数名称) create function split_pid(str varchar (1000),delimiter varchar(1)) returns ...
- 查看linux上面是否有安装redis
- PHP反序列化漏洞新攻击面(BlackHat 2018)
0x00 前言 入职以来好久没有写过文章了,入职的时间里也和师傅们学到了很多,认识了很多的新朋友.最近因为BlackHat 黑客大会的一个议题,PHP反序列化漏洞利用被挖掘出新的攻击面.这里本着记 ...
- solr 服务搭建
1. linux 中 安装jdk, tomcat, 2. 下载 solr-4.10.3.tgz.tgz 并解压 解压后文件夹:solr-4.10.3 3. 将 solr-4.10.3/dist 下 ...
- MongoDB ver 4 几个常用命令
1. 为某个数据库创建用户: use db_test1; db.createUser({ user:"test_user_1", pwd:"test_user_1_pwd ...
- Yii 使用Widge面面观
我们可以把Widget视为一个嵌入到控制器管理 的视图中的微控制器,其实就是.net框架中的用户控件,或者类似于.net MVC中的子视图.与controller相比较,微件没有既没有动作,也没有过滤 ...
- Nginx 反向代理(http转htpps,并支持80端口继续提交post请求)
项目是一个web server + 多个client的形式,client由用户安装在自己的电脑上 由http升级为https后,我们通过在Nginx做了80端口重定向443的配置,使用户通过访问htt ...
- PHP之mb_strpos使用
mb_strpos (PHP 4 >= 4.0.6, PHP 5, PHP 7) mb_strpos - Find position of first occurrence of string ...