搜索结果
查询Tags标签: cin,共有 547条记录-
【数论】快速幂
$对于a^{b} ,可以用O(logb)的时间复杂度求出,使用二进制拆分的思想将b拆分成二进制,分别得出a^{2^{0}},a^{2^{1}}...a^{2^{n}}之后求积即可。$1 #include <iostream>2 using namespace std;3 4 long long qmi(int a,int b,int p)5 {6 long long res = 1,base …
2021/10/30 23:17:48 人评论 次浏览 -
1606A - AB Balance(构造性算法+字符串+级)
1606A - AB Balance(源地址自⇔CF1606A) Problemtag: ⇔构造性算法、⇔字符串、⇔级(*) 题意: 对于给定的只包含 \(a\) 和 \(b\) 的字符串,请你通过最少的修改次数,使得新的字符串中 \(ab\) 和 \(ba\) 的子串数量相同。输出这个新的子串 思路: 显然的,连续的 \(…
2021/10/30 14:12:23 人评论 次浏览 -
1606A - AB Balance(构造性算法+字符串+级)
1606A - AB Balance(源地址自⇔CF1606A) Problemtag: ⇔构造性算法、⇔字符串、⇔级(*) 题意: 对于给定的只包含 \(a\) 和 \(b\) 的字符串,请你通过最少的修改次数,使得新的字符串中 \(ab\) 和 \(ba\) 的子串数量相同。输出这个新的子串 思路: 显然的,连续的 \(…
2021/10/30 14:12:23 人评论 次浏览 -
数据结构算法——1063. 树的双亲存储法
题目思路 把这个顺序储存变成链式储存再进行后序遍历(先左子树,然后右子树,再根节点) 前中后遍历介绍 由于不知道是几叉树,所以交给万能的STL了就不自己搞链树了 代码 #include<bits\stdc++.h> using namespace std;int Count = 0; void Postorder(int n, vect…
2021/10/30 11:11:07 人评论 次浏览 -
数据结构算法——1063. 树的双亲存储法
题目思路 把这个顺序储存变成链式储存再进行后序遍历(先左子树,然后右子树,再根节点) 前中后遍历介绍 由于不知道是几叉树,所以交给万能的STL了就不自己搞链树了 代码 #include<bits\stdc++.h> using namespace std;int Count = 0; void Postorder(int n, vect…
2021/10/30 11:11:07 人评论 次浏览 -
21天好习惯第一期—7
牛客小白月赛39 1.A—憧憬 题解:数学题目,详细见代码。AC代码如下: #include <bits/stdc++.h> using namespace std; int main() {int n;cin>>n;int a[n][4];for(int i=0;i<n;i++){cin>>a[i][0]>>a[i][1]>>a[i][2]>>a[i][3];}…
2021/10/30 6:13:04 人评论 次浏览 -
21天好习惯第一期—7
牛客小白月赛39 1.A—憧憬 题解:数学题目,详细见代码。AC代码如下: #include <bits/stdc++.h> using namespace std; int main() {int n;cin>>n;int a[n][4];for(int i=0;i<n;i++){cin>>a[i][0]>>a[i][1]>>a[i][2]>>a[i][3];}…
2021/10/30 6:13:04 人评论 次浏览 -
实验二
//info.hpp#ifndef INFO_HPP #define INFO_HPP #include<iostream> #include<string>using namespace std;class Info{ public:Info(string a,string b,string c,int d):nickname{a},contact{b},city{c},n{d}{}void print(){cout << "nickname: \t…
2021/10/29 6:11:39 人评论 次浏览 -
实验二
//info.hpp#ifndef INFO_HPP #define INFO_HPP #include<iostream> #include<string>using namespace std;class Info{ public:Info(string a,string b,string c,int d):nickname{a},contact{b},city{c},n{d}{}void print(){cout << "nickname: \t…
2021/10/29 6:11:39 人评论 次浏览 -
一些铜牌题
题目集1 A https://vjudge.net/contest/412612#problem/A 求有多少个S子串满足长度是M*L,子串划分为M节长度为L的小子串,M节小子串的每一位都不同 解:哈希然后尺取 #include <bits/stdc++.h>#define ll long long#define ull unsigned long long#define rep(i,a,…
2021/10/29 6:09:47 人评论 次浏览 -
一些铜牌题
题目集1 A https://vjudge.net/contest/412612#problem/A 求有多少个S子串满足长度是M*L,子串划分为M节长度为L的小子串,M节小子串的每一位都不同 解:哈希然后尺取 #include <bits/stdc++.h>#define ll long long#define ull unsigned long long#define rep(i,a,…
2021/10/29 6:09:47 人评论 次浏览 -
1065 A+B and C (64bit) (20 分)
1. 题目 Given three integers A, B and C in \((−2^{63},2^{63})\), you are supposed to tell whether A+B>C. Input Specification: The first line of the input gives the positive number of test cases, T (≤10). Then T test cases follow, each consists of…
2021/10/28 23:17:26 人评论 次浏览 -
1065 A+B and C (64bit) (20 分)
1. 题目 Given three integers A, B and C in \((−2^{63},2^{63})\), you are supposed to tell whether A+B>C. Input Specification: The first line of the input gives the positive number of test cases, T (≤10). Then T test cases follow, each consists of…
2021/10/28 23:17:26 人评论 次浏览 -
一个好玩的现象:getline() cannot be used after Cin directly
reference : > - GeeksforGeeks" href="https://www.geeksforgeeks.org/problem-with-getline-after-cin/" rel="external nofollow" target="_blank">Problem with getline() after cin >> - GeeksforGeeksA Computer Sc…
2021/10/27 23:09:56 人评论 次浏览 -
一个好玩的现象:getline() cannot be used after Cin directly
reference : > - GeeksforGeeks" href="https://www.geeksforgeeks.org/problem-with-getline-after-cin/" rel="external nofollow" target="_blank">Problem with getline() after cin >> - GeeksforGeeksA Computer Sc…
2021/10/27 23:09:56 人评论 次浏览