网站首页 站内搜索

搜索结果

查询Tags标签: cin,共有 547条记录
  • 杭电OJ 2024(C++)

    C语言合法标识符 #include<iostream> using namespace std; #include<string>int main() {int i,j,n,k=0;string a;while(cin>>n){getline(cin,a);for(i = 0 ; i < n ; i++){ getline(cin,a);if(a[0] >= 0 && a[0]<= 9){cout<<&…

    2021/7/18 12:05:46 人评论 次浏览
  • AtCoder Beginner Contest 210

    AtCoder Beginner Contest 210 A - Cabbages int main() {IOS;ll n, a, x, y, ans = 0;cin >> n >> a >> x >> y;if (n > a)ans = a * x + (n - a) * y;elseans = n * x;cout << ans;return 0; }B - Bouzu Mekuri int main() {IOS;cin &…

    2021/7/17 23:19:16 人评论 次浏览
  • AtCoder Beginner Contest 210

    AtCoder Beginner Contest 210 A - Cabbages int main() {IOS;ll n, a, x, y, ans = 0;cin >> n >> a >> x >> y;if (n > a)ans = a * x + (n - a) * y;elseans = n * x;cout << ans;return 0; }B - Bouzu Mekuri int main() {IOS;cin &…

    2021/7/17 23:19:16 人评论 次浏览
  • 2021牛客多校第一场

    来源 A - Alice and Bob (sg函数打表) 暴力打表,时间复杂度为O(n^3logN)。可以发现后手胜的状态数非常少:如果某堆石头数量是i,另一堆石头最多只有一种数量满足后手胜。反证法:假设 (i, p) 和 (i, q) 都是后手必胜,且 q > p。那么在状态 (i, q) 时,先手可以在第…

    2021/7/17 23:05:53 人评论 次浏览
  • 2021牛客多校第一场

    来源 A - Alice and Bob (sg函数打表) 暴力打表,时间复杂度为O(n^3logN)。可以发现后手胜的状态数非常少:如果某堆石头数量是i,另一堆石头最多只有一种数量满足后手胜。反证法:假设 (i, p) 和 (i, q) 都是后手必胜,且 q > p。那么在状态 (i, q) 时,先手可以在第…

    2021/7/17 23:05:53 人评论 次浏览
  • cin读取数字时遇到字符的总结——C++ primer plus 代码引起思考, 为什么输入q使得程序结束,

    1 // lotto.cpp -- probability of winning2 #include <iostream>3 // Note: some implementations require double instead of long double4 long double probability(unsigned numbers, unsigned picks);5 int main()6 {7 using namespace std;8 double t…

    2021/7/17 9:37:03 人评论 次浏览
  • cin读取数字时遇到字符的总结——C++ primer plus 代码引起思考, 为什么输入q使得程序结束,

    1 // lotto.cpp -- probability of winning2 #include <iostream>3 // Note: some implementations require double instead of long double4 long double probability(unsigned numbers, unsigned picks);5 int main()6 {7 using namespace std;8 double t…

    2021/7/17 9:37:03 人评论 次浏览
  • 杭电OJ 2021(C++)

    发工资咯:) #include<iostream> using namespace std; #include<cmath>int main() {int n,i,sum = 0;while(cin>>n){if(n == 0)break;int *a = new int[n];for(i = 0 ; i < n ; i++)cin>>a[i];for(i = 0 ; i < n ; i++){sum += a[i] / 10…

    2021/7/17 9:35:57 人评论 次浏览
  • 杭电OJ 2021(C++)

    发工资咯:) #include<iostream> using namespace std; #include<cmath>int main() {int n,i,sum = 0;while(cin>>n){if(n == 0)break;int *a = new int[n];for(i = 0 ; i < n ; i++)cin>>a[i];for(i = 0 ; i < n ; i++){sum += a[i] / 10…

    2021/7/17 9:35:57 人评论 次浏览
  • [codeforces] 暑期训练之打卡题

    Day1《Vanya and Lanterns》 题意: 一条长度为 l 的街道,在这条街道上放置了n个相同的灯,街道一端位置记为0,每个灯的位置在ai处,问灯的最小照射半径为多少时,才能满足整条街道都能被灯光照到 。 题解:输入所有的灯的位置,然后进行排序。 比较每两个相邻的灯的距离…

    2021/7/14 23:47:55 人评论 次浏览
  • [codeforces] 暑期训练之打卡题

    Day1《Vanya and Lanterns》 题意: 一条长度为 l 的街道,在这条街道上放置了n个相同的灯,街道一端位置记为0,每个灯的位置在ai处,问灯的最小照射半径为多少时,才能满足整条街道都能被灯光照到 。 题解:输入所有的灯的位置,然后进行排序。 比较每两个相邻的灯的距离…

    2021/7/14 23:47:55 人评论 次浏览
  • 【c++】cin、cout

    cin 用户从标准输入中读取的istream对象 cout 用户写入到标准输出的ostream对象,一般情况下用于程序的输出。 buffer 缓冲区 一般用来存放数据的存储区域。IO设备常存储输入(或输出)到缓冲区,并独立于程序动作对缓冲区进行读写。输出缓冲区通常必须显式刷新以强制输出…

    2021/7/14 9:05:31 人评论 次浏览
  • 【c++】cin、cout

    cin 用户从标准输入中读取的istream对象 cout 用户写入到标准输出的ostream对象,一般情况下用于程序的输出。 buffer 缓冲区 一般用来存放数据的存储区域。IO设备常存储输入(或输出)到缓冲区,并独立于程序动作对缓冲区进行读写。输出缓冲区通常必须显式刷新以强制输出…

    2021/7/14 9:05:31 人评论 次浏览
  • Codeforces Round #732 (Div. 2)

    B. AquaMoon and Stolen String 这题就是把一个字符串拿走了,但是给了我们原来的和剩下的,所以别看中途配对又交换了,直接相减就行了。代码string s[N], s1[N]; int main() {//ios::sync_with_stdio(false); cin.tie(nullptr);int t;cin >> t;while (t--) {int n…

    2021/7/14 6:05:13 人评论 次浏览
  • Codeforces Round #732 (Div. 2)

    B. AquaMoon and Stolen String 这题就是把一个字符串拿走了,但是给了我们原来的和剩下的,所以别看中途配对又交换了,直接相减就行了。代码string s[N], s1[N]; int main() {//ios::sync_with_stdio(false); cin.tie(nullptr);int t;cin >> t;while (t--) {int n…

    2021/7/14 6:05:13 人评论 次浏览
扫一扫关注最新编程教程