对于已知个数的集合来说,枚举其非空子集的最简单方法是二进制枚举法 void print_subset(int n,int s) { for(int i=0;i<n;i++) { if(s&(1<<i)) { printf("%d ",i); //事实上i输出的是集合的数组标号 } } cout<<e ...
分类:
编程语言 时间:
2020-07-25 09:38:01
阅读次数:
68
比赛链接:https://codeforces.com/contest/1390 A. 123-sequence 题意 给出一个只含有 $1,2,3$ 的数组,问使所有元素相同至少要替换多少元素。 题解 统计数组中出现次数最多的元素即可。 代码 #include <bits/stdc++.h> us ...
分类:
其他好文 时间:
2020-07-24 21:43:12
阅读次数:
67
设置背景图已知有三种方法 background:url();//平铺 background-image:url();//平铺 border-image:url();//拉伸填充 其中第一种方法可以直接在尾部添加no-repeat阻止图片平铺;第二种则需要添加background-repeat语句: ...
分类:
其他好文 时间:
2020-07-24 15:34:43
阅读次数:
167
我的错误代码: 1 #include<iostream> 2 #include <iomanip> 3 4 using namespace std; 5 6 int main() 7 { 8 int N; 9 cin>>N; 10 11 int n; 12 int j=1; 13 int sum0= ...
分类:
其他好文 时间:
2020-07-24 15:33:40
阅读次数:
68
QtQuick新增了一些新控件,其中一个就是计量仪(官方的例子给出的是类似计速仪的东西)。采用QML描述。简单调用,使用quick控件打包发布后大约120多M,上个图Qtquick常用控件.(参考Qt文档或有梦想的伟仔的博客)QMLType1.Container2.DelayButton3.Dial4.DialogButtonBox5.Dialog6.Drawer7.Menu8.MenuBar9.
分类:
编程语言 时间:
2020-07-24 13:29:15
阅读次数:
96
代码如下: 将小写转换为大写 #include<cstdio> #include<iostream>#include<algorithm>using namespace std;int main(){ char a; cin>>a; char b; b=a-32; cout<<b<<endl; re ...
分类:
其他好文 时间:
2020-07-24 09:57:40
阅读次数:
62
QT Creator5.9.9 –标题隐藏记录。当窗口作为子部件的时候,标题栏是不会显示的,此处是主窗体的标题栏隐藏方法。隐藏方法:setWindowFlags( Qt::FramelessWindowHint);但是这个属性设置后,窗口就无法移动了,要想通过鼠标移动窗口,需要自己实现。实现方法:重... ...
分类:
移动开发 时间:
2020-07-23 22:22:05
阅读次数:
98
//打印两个整数指定范围的所有整数 #include<iostream> int main() { int sum=0; int a=0,b=0; std::cout<<"请输入两个整数:"<<std::endl; std::cin>>a>>b; int tmp=a; if(a>=b) { whil ...
分类:
其他好文 时间:
2020-07-23 16:24:59
阅读次数:
81
数学结论: (1)a%b的最大值是b-1; (2)f(m)=m%a1 + m%a2 +......+ m%an 的最大值是(a1-1) +......+(an-1)。 题目描述 现给定n个整数,并定义一个非负整数m,且令f(m) = (m%a1)+(m%a2)+...+(m%an)。此处的X % Y ...
分类:
其他好文 时间:
2020-07-23 16:00:19
阅读次数:
75
QThread编程示例 class MyThread: public QThread //创建线程类 { protected: void run() //线程入口函数 { for(int i=0; i<5; i++) { qDebug() << objectName() << ":" << i; s ...
分类:
编程语言 时间:
2020-07-23 09:21:43
阅读次数:
103