码迷,mamicode.com
首页 >  
搜索关键字:cout    ( 7219个结果
bitset
bitset 1.初始化一个bitset bitset <8> b(6); // 把数字6初始化为一个8位的二进制 2.以二进制输出bitset cout << b << endl; // 结果:00000110 3.取反 cout << ~b << endl; // 把b的所有位取反 cout < ...
分类:其他好文   时间:2020-08-15 22:40:24    阅读次数:77
计蒜客 T1725 国王的魔镜
首先取出这个项链的长度x,如果他是回文数的话让项链减去一半,x减去一半,如果他不是回文数,就退出循环 上代码: #include <iostream>#include <cstdio>#include <cmath>#include <cstring>#include <algorithm>#inc ...
分类:其他好文   时间:2020-08-13 12:13:39    阅读次数:53
用正则表达式验证表格的格式
/* 用正则表达式验证一个表格的格式。 如果表格格式合乎要求,程序会输出 "all is well" 到 cout; 否则会将错误消息输出到 cerr。 一个表格由若干行组成,每行包含四个由制表符分隔的字段。 例如: Class Boys Girls Total 1a 12 15 27 1b 16 ...
分类:其他好文   时间:2020-08-09 20:21:57    阅读次数:101
A Very Easy Graph Problem
A Very Easy Graph Problem 题解:首先根据\(2^{i}\)的特殊性,我们可以发现最短路其实就是最小生成树上的路,那么我们就可以先把图换成最小生成树;然后我们看一条边要经过几次,就是要看一条边对答案的贡献:某一条边被遍历的次数必定是这条边下面的所有权值1的点的个数 * 这条边 ...
分类:其他好文   时间:2020-08-08 21:19:30    阅读次数:82
2020hdu多校第六场1006A Very Easy Graph Problem
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=6832 题意:在一个n个结点,m条边的无向连通图中,且第i条边的权值为2i,每个结点有一个值,为1或者0。d(i,j)表示结点i到结点j之间的最短距离。对所有节点求所有的可能配对形式d(i,j)*[a[i ...
分类:其他好文   时间:2020-08-07 12:39:03    阅读次数:128
HDU6828 Little Rabbit's Equation(简单模拟)
Problem Description Little Rabbit is interested in radix. In a positional numeral system, the radix is the number of unique digits, including the digi ...
分类:其他好文   时间:2020-08-06 20:41:05    阅读次数:67
《算法竞赛进阶指南》0x5C计数DP Gerald & Giant Chess
题目链接:https://www.acwing.com/problem/content/description/308/ 给定一个h*w的棋盘,上面有少于2000个黑色格子,其他是白色,问不经过黑色格子从(1,1)走到(h,w)的路线有多少个? 将黑色格子按照(x,y)进行排序,设计f[i]为从(1 ...
分类:编程语言   时间:2020-08-06 09:34:02    阅读次数:74
DNA序列 (HJ63)
一:解题思路 二:完整代码示例 (C++版和Java版) C++代码: #include <iostream> #include <string> using namespace std; int main() { string s = ""; int n = 0; while (cin >> s ...
分类:其他好文   时间:2020-08-03 13:30:56    阅读次数:76
位运算统计二进制整数中1的个数
k=k&(k-1)可以消除k的二进制数的最后一个1.连续进行这个操作,每次消除一个1,直到全部消除为止。操作次数就是1的个数。 int num=0; cin>>k; while(k>0) { k=k&(k-1); num++; } cout<<num<<endl; ...
分类:其他好文   时间:2020-08-03 09:50:59    阅读次数:87
7219条   上一页 1 ... 18 19 20 21 22 ... 722 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!