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 ...
随机推荐
- PHP中define()和dirname(__FILE__)
1,define() 函数定义一个常量.常量类似变量,不同之处在于: (1)在设定以后,常量的值无法更改 (2)常量名不需要开头的美元符号 ($) (3)作用域不影响对常量的访问 (4)常量值只能是字 ...
- 快速搭建微信小程序开发环境
1.工具软件: 注:本文介绍的工具软件已分享到百度云盘,直接下载并按照本文介绍安装即可. 开发工具 v0.7 百度云链接: https://pan.baidu.com/s/1jIQ7i8A密码: aq ...
- django 运行报错汇总
记录自己在使用django开发过程中遇到的问题,不间断更新. (1) 独立运行普通Python脚本调用django中定义的类报错 报错信息: django.core.exceptions.Improp ...
- leetcode-8-字符串转整数 (atoi)
题目描述: 实现 atoi,将字符串转为整数. 在找到第一个非空字符之前,需要移除掉字符串中的空格字符.如果第一个非空字符是正号或负号,选取该符号,并将其与后面尽可能多的连续的数字组合起来,这部分字符 ...
- SHELL脚本进阶
一.读取参数 $0 程序名称$1 第一个参数$2 第二个参数,依次类推可以使用 basename 来读取程序名称:basename $0 可以使用 dirname 来读取第一个参数的目录:dirnam ...
- TX2 i2c-tools使用
安装: apt-get install libi2c-dev i2c-tools 检测i2c总线数目 用i2cdetect检测有几组i2c总线在系统上: i2cdetect -l 可以看到系统中有9组 ...
- elasticsearch 基础笔记
基础: 1.查看 所有节点,及版本 http://192.168.18.7:9200/_nodes/_all/version?pretty=true
- CF1012C Hills 题解【DP】
思路还是比较简单的 dp 吧,但是就是想不出来-甚至类似的方程都被自己推翻了 Description Welcome to Innopolis city. Throughout the whole y ...
- win10开启 linux Bash命令(win10内置了linux系统支持)
win10开启 Ubuntu linux Bash命令(win10内置了linux系统支持) 第一步: 先在设置→更新和安全→针对开发人员中选择"开发人员模式",点击后会下载&qu ...
- django notes 七:Using Forms
form 也没什么可说的,我只给一个例子大家就懂了 form model from django import forms class UserForm(forms.Form): username = ...