ICode9

精准搜索请尝试: 精确搜索
  • 1064 朋友数 较简单2022-07-11 20:31:11

    代码 #include <iostream> #include <cstdio> #include <string> #include <set> using namespace std; int main() { int n; string a; int tmp; set<int> st; cin>>n; for(int i=0;i<n;i++){ cin>>a; tmp=0; for(in

  • 1057 数零壹2022-07-11 12:32:36

    关键 二进制的算法 代码 #include <iostream> #include <cstdio> #include <string> using namespace std; int main() { string s; int cnt=0; int zcnt=0,ocnt=0; getline(cin,s,'\n'); for(int i=0;s[i]!=NULL;i++){ if(s[i]<='z'

  • c++创建简易通讯录(课程设计)2022-07-10 23:32:56

    #include<iostream>  using namespace std; #include<string> //创建通讯录存储最多的人数  #define MAX 1000     //创建联系人结构体  struct Person { string name; int sex; int age; int phone; string adder; }; //创建通讯录结构体  struct Adressbook { struct Pers

  • 猴子吃桃2022-07-10 22:03:54

    一只小猴子一天摘了许多桃子,第一天吃了一半,然后忍不住又吃了一个;第二天又吃了一半,再加上一个;后面每天都是这样吃。到第10天的时候,小猴子发现只有一个桃子了。问小猴子第一天共摘了多少个桃子。 #include <iostream>using namespace std;int main() {    int a=1;    for(int

  • 1054 求平均值2022-07-10 18:31:57

    易错点 变量名要看清楚 操作数组要谨慎 代码 #include <iostream> #include <cstdio> #include <string> #include <iomanip> using namespace std; int main(){ int n; string s; cin>>n; int f=0; int f2; int cnt=0; float t=0; for(int i=0;i<n

  • c++(十二)2022-07-10 17:34:11

    c++另一种编程思想称为泛型编程,主要是利用的技术就是模板 c++提供两种模板机制:函数模板和类模板    函数模板作用: 建立一个通用函数,其函数的返回值类型和形参类型可以不具体指定,用一个虚拟的类型来代表 template<typename T>     //template--声明创建模板   typename--表

  • Akuna Capital笔试第二题, 找出异或大于与操作的对数量2022-07-10 12:00:32

    题意很简单,就是给一个数组,找出有多少个对是x ^ y > x & y 首先这题cf味道很冲,感觉当个div2b不是问题,那么我们就来考虑下高位讨论    所以我们可以计算出来每个ai的高位是多少,然后等差数列求和一下就行,最后用总对数减掉高位相同的对数,就是我们要的答案 #include <bits/stdc++.h

  • Educational Codeforces Round 131 (Rated for Div. 2) A —— C2022-07-10 11:37:56

    A. Grass Field 解决代码: void solve() { int a, b, c, d; cin >> a >> b >>c >>d; int cnt = 0; cnt = a + b +c + d; if(cnt == 0) cout << 0 << endl; else if(cnt == 4) cout << 2 << endl; else cout << 1 &

  • KMP2022-07-09 23:36:14

    P3375 这里字符串以 \(0\) 开始。 #include<bits/stdc++.h> using namespace std; #define f(i, a, b) for(int i = (a); i <= (b); i++) #define cl(i, n) i.clear(),i.resize(n); #define endl '\n' typedef long long ll; typedef unsigned long long ull; ty

  • 【C++】学生管理系统2022-07-09 23:33:05

    【C++】学生管理系统 一道非常经典的C语言题目,用C++实现   题目如下: 输入功能:由键盘输入10个学生的学号、姓名、三科成绩,并计算出平均成绩和总成绩,然后将它存入文件stud.dat。 插入功能:按学号增加一个学生信息,并将其插入到stud.dat中。 排序功能,按要求对学生信息进行排序,分为按

  • 1049 数列的片段和 测试点2、3数据精度问题2022-07-09 18:31:20

    问题 cnt=cnt+a[i]*(i+1)*(n-i); 此处容易溢出,因此必须用long double 注意点 cout的格式化输出,iomanip cout<<fixed<<setprecision(2)<<cnt; 代码 #include <iostream> #include <cstdio> #include <iomanip> using namespace std; long double a[100003]

  • 小学期2022-07-09 13:01:49

    完成了小学期的指定内容 #include<iostream>#include<math.h>#include <stdlib.h>using namespace std;class Dian {private: double x, y, z;public: void srzb();//输入xyz void qrzb();//输出刚才输入的坐标并确认 double getx() { return x; } double gety() { return y; } do

  • NC23050 华华对月月的忠诚2022-07-09 08:32:40

    https://ac.nowcoder.com/acm/problem/23050 最大公约数的辗转相除法 点击查看代码 #include <bits/stdc++.h> using namespace std; #define int long long int gcd(int a,int b) { return b ? gcd(b,a%b) : a; } signed main() { ios::sync_with_stdio(false);

  • 1043 输出PATest2022-07-08 23:00:27

    代码 #include <iostream>#include <cstdio>#include <map>using namespace std;​​int main(){ char c; map<char,int> mp; mp['P']=0; mp['A']=0; mp['T']=0; mp['e']=0; mp['s�

  • 7月2日训练总结2022-07-08 18:33:28

    900——1000 5道 A. Anti Light's Cell Guessing 题意大概是在一个行列确定的坐标系里,最少用几个点可以唯一确定一个点 思路就是判断行列的最小值是否为1,是1的话,最多一个点就可以确定,否则两个点即可。 注意:1*1的方格需要的点是0,故需要特判 解决代码: void solve() { int n, m; ci

  • Educational Codeforces Round 130 (Rated for Div. 2) C. awoo's Favorite Problem2022-07-08 02:04:32

    https://codeforc.es/contest/1697/problem/C 因为规则中,两种字符串变换都与‘b’有关,所以我们根据b的位置来进行考虑; 先去掉所有的'b',如果两字符串不相等就“NO”; 否则通过‘b'在a,b串中的位置,如果posa>posb,那么他们之间如果出现'a'就说明不可能 如果posb<posa,那么他们之间如果

  • bitset使用说明及典型例题2022-07-07 15:34:12

    转载博客: https://blog.csdn.net/weixin_45697774/article/details/105563993?utm_medium=distribute.pc_relevant.none-task-blog-2~default~baidujs_baidulandingword~default-0-105563993-blog-106273675.pc_relevant_multi_platform_whitelistv1&spm=1001.2101.3001.4242

  • std::是什么?2022-07-06 14:31:12

    1.std是什么? std::是个名称空间标示符,C++标准库中的函数或者对象都是在命名空间,std中定义的,所以我们要使用标准库函数中的函数或对象来使用std来限定。 对象count是标准函数库所提供的对象,而标准库函数在名字空间中被指定为std,所以在使用cout的时候要加上std::,这样编译器就会明白

  • 【Day4】一名菜鸟ACMer的暑假训练2022-07-06 12:32:06

    【Day4】一名菜鸟ACMer的暑假训练 CF构造题1200-1400 D. Districts Connection https://codeforces.com/problemset/problem/1433/D 1200 pair<帮派,编号>排序 第一个帮派的第一个成员连向不同帮派的所有成员, 第一个帮派的其他成员连向任意一个不同帮派的成员 #include <bits/std

  • 1008 [NOIP2002]过河卒 线性DP 动态规划2022-07-05 18:35:03

    链接:https://ac.nowcoder.com/acm/contest/24213/1008来源:牛客网 题目描述 如图,A 点有一个过河卒,需要走到目标 B 点。卒行走规则:可以向下、或者向右。同时在棋盘上的任一点有一个对方的马(如上图的C点),该马所在的点和所有跳跃一步可达的点称为对

  • printStar2022-07-05 16:36:20

    #include<iostream>using namespace std; /*    *   * *  * * * * * * ** * * * ** * * * * * * * *  * * *   * *    **/ void starup(int n) {     for (int i = 1; i <= n; i++)    {        for (int j = 0; j < n - i; j++)            cout << "

  • 用new运算符初始化但个数据存储区2022-07-05 11:03:26

    #include<iostream>using namespace std;int main() {     int *p;    p = new int(100);    if (p == NULL)    {        cout << "allocation failure" << endl;    }    else    {        cout << "p 的值为: "<<*p <&l

  • HDL Bits---More Verilog Features2022-07-04 21:04:30

    2.5.1 Conditional temary operator  module top_module ( input [7:0] a, b, c, d, output [7:0] min);// wire [7:0]r1,r2;  //记得定义位宽 assign r1=(a<b)?a:b; assign r2=(c<d)?c:d; assign min=(r1<r2)?r1:r2;endmodule   2.5.2 Reduction operat

  • Codeforces Round #803 (Div. 2)2022-07-04 21:04:08

    比赛链接: https://codeforces.com/contest/1698 C. 3SUM Closure 题意: 给定一个序列 \(a\),判断对于任意一个 \(1 <= i < j < k <= n\),是否存在一个 \(1 <= l <= n\),使得 \(a[i] + a[j] + a[k] = a[l]\)。 思路: 首先如果有三个正数及以上的正数,那么选择其中最大的三个,它们的和肯定

  • 1-stl介绍_题解2022-07-04 15:05:39

    1-stl介绍_题解 2022/7/4-ACM暑期集训 A,最大或位_位运算贪心 题目大意 中文题自己看 思路和代码 要xy的或值最大则尽量让每一位或的结果都是1。考虑将y固定在r,x从l一点点变大。所以我们要让x在不大于r的情况下尽可能大。从大往小考虑二进制位。一旦出现“1<->0”的情况就表示后面

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有