网站首页 站内搜索

搜索结果

查询Tags标签: cout,共有 1241条记录
  • 第十二届蓝桥杯省赛C/C++ B组

    空间 掌握基本的不同单位的空间换算即可 #include<iostream> #include<cstring> #include<algorithm> using namespcae std; int main() {cout<<256*1024*1024*8/32;return 0; }

    2022/3/19 1:27:37 人评论 次浏览
  • Educational Codeforces Round 123 (Rated for Div. 2) E. Expand the Path

    自己没想出来 参考了大佬们的博客 添加链接描述 #include<bits/stdc++.h> #define int long long using namespace std; const int N=200005; int t,n;string s; int32_t main(){cin>>t;while(t--){cin>>n>>s;int m=s.size();int pos=1,x=0,y=0;w…

    2022/3/18 23:57:37 人评论 次浏览
  • SFINAE几种实现方式

    一、通过函数返回值实现template<class T> typename std::enable_if<std::is_trivially_default_constructible<T>::value>::type construct(T*) {std::cout << "default constructing trivially default constructible T\n"; }templa…

    2022/3/11 23:20:37 人评论 次浏览
  • 04

    #include<iostream> using namespace std;void fun(int* a, int* b) {int x = *a;*a = *b;*b = x;cout << *a << *b << " "; } int main() {int x = 1, y = 2;fun(&x, &y);cout << x << y << endl;return 0;…

    2022/3/8 23:18:06 人评论 次浏览
  • C++指针、数组和指针算数

    指针和数组基本等价的原因在于指针算数(pointer arithmetic)和C++内部处理数组的方式。首先,我们来看一看算术。将整数变量加1后,其值将增加1;但将指针变量加1后,增加的量等于它指向的类型字节数。将指向double的指针加1后,如果系统对double使用8个字节存储,则数值…

    2022/3/6 14:50:49 人评论 次浏览
  • C++常用遍历和查找算法

    for_each #include<iostream> #include<string> using namespace std; #include<vector> #include<algorithm>/*for_each遍历 for_each(v.begin(), v.end(), MyPrint()); //参数列表:1:起始迭代器,2:结束迭代器,3:函数对象或函数名 */class…

    2022/3/6 12:46:32 人评论 次浏览
  • 程序填空_3

    源程序: #include <iostream>using namespace std;int time=0,end=0;class Test{public: Test() { if(time==0) //程序填空 cout<<"欢迎使用测试程序!"<<endl; time=time+1; } ~Test() { end=end+1; if(end==time) cout<<&q…

    2022/3/6 12:45:09 人评论 次浏览
  • 未解之谜

    class D {int a,b;public:D(int i = 0, int j=0):a(i),b(j){} D(D&p){a = p.a;b=p.a;}void show(){cout<<a<<""<<b<<endl; } }; D f(D p){D d1(p);return d1; } int main() {D o1,o2(2,3);//??o2 = f(o1);o2.show();return 0…

    2022/3/6 6:16:41 人评论 次浏览
  • Codeforces Round #774 (Div. 2) C. Factorials and Powers of Two(暴力/dfs/位运算)

    include <bits/stdc++.h> define gcd(a, b) __gcd(a, b) define INF 0x3f3f3f3f3f define eps 1e-6 define PI acos(-1.0) define pb push_back define fst first define sec second define eif else if define de(x) cout << x << define en cout &l…

    2022/3/5 23:15:22 人评论 次浏览
  • oj在线判题程序设计竞赛c++小技巧

    最近在做oj题目狂补数据结构和算法(doge) 其中涉及到很多之前学习c++的时候不知道的一些《奇技淫巧》,持续更新ing 1.每次都需要添加很多c++的库文件??? 你可以尝试“万能头文件”#include <bits/stdc++.h>这行代码可以在devcpp 6.3中直接使用,在visual stud…

    2022/3/5 9:15:09 人评论 次浏览
  • C++STL提供几个二分查找的方法

    C++STL提供几个二分查找的方法。lower_bound()返回第一个大于等于查找值的指针,函数接受三个参数,开始位置,结束位置,查找值。upper_bound()返回第一个大于查找值的指针,函数接受三个参数,开始位置,结束位置,查找值。binary_search()返回bool类型,是否找到对应数…

    2022/3/4 9:15:08 人评论 次浏览
  • c++继承与派生,多态

    /*继承与派生1 请以点类Point为基类派生出一个圆类Circle。 圆类Circle的数据成员为r(私有属性,存储圆的半径,圆心的点坐标通过继承点类Point加以实现), 成员函数有构造函数Circle、计算圆的面积函数Area、计算圆的周长函数Perimeter和输出函数Display, 其中构造函数…

    2022/3/3 20:17:37 人评论 次浏览
  • C++ 面试常问问题(一)

    这篇文章讲解C++ 面试常问的几个问题。本文通过demo讲解初始化列表,继承,字符串等常问问题。看下边这个例子 初始化列表 //基类 class Base { public:Base() : m_nbase(0), m_nbase2(m_nbase + 100) {}Base(int n) : m_nbase(n), m_nbase2(m_nbase + 100){cout <<…

    2022/3/3 12:15:01 人评论 次浏览
  • 求两个整数的商,结果保留六位小数(第一章 1.1)

    一、问题描述 【问题描述】 输入两个整数a和b,求a/b的结果。 【输入形式】 整数a和整数b,空格分隔 【输出形式】 a/b的结果 【样例输入】 4 2 【样例输出】 2.000000 二、题目分析 1.输入的两个数为整数,输出的却是小数(一般小数会被默认为双精度实型) 所以我们可以再…

    2022/3/3 6:17:36 人评论 次浏览
  • 1098 Insertion or Heap Sort (25 分)(插入排序 堆排序

    添加链接描述 #include<bits/stdc++.h> using namespace std; const int N=200; int arr[N]; int brr[N]; void down(int u,int n){int t=u;if(u*2<=n&&brr[u*2]>brr[u])t=u*2;if(u*2+1<=n&&brr[u*2+1]>brr[t])t=u*2+1;if(t!=u){swap(b…

    2022/3/2 23:17:02 人评论 次浏览
扫一扫关注最新编程教程