
省赛题练习
Dance_Devil
fcsqppppahhhhjnnnmj c++
展开
-
小猫吃鱼:fish.cpp
题目描述原理:明明家从 1 号站点出发,开车去旅游,一共要经过 n 个站点,依次为 2、3……n。由于明明带上了心爱的小猫,在每个站点都要为小猫提供一条鱼用做美餐(包括 1 号站点)。除了 1 号站点只能吃 1 号站点买的鱼,其他站点既可以吃当地买的鱼,也可吃之前经过的站点买了存入车载冰箱中的鱼。但车载冰箱消耗的电能来自汽油,所以每条鱼用冰箱保存到下一站的费用与各个站点的汽油价格有关。为使问题简化,我们约定:(1)车从某站开出时油箱中都是此站点刚加的汽油。(2)车载冰箱能容纳一路上需要的所有原创 2020-12-24 21:15:35 · 1236 阅读 · 0 评论 -
水下探测器:deep.cpp
#include<bits/stdc++.h>using namespace std;int main() { string s1; int h,s,i; cin>>h>>s>>s1; for(i=0;i<s1.size();i++){ if(s1[i]=='u'){ if(s>0){ s=s-1; }原创 2020-12-21 20:18:22 · 706 阅读 · 0 评论 -
中间值
#include <iostream>#include <iomanip>using namespace std;int main() { int n; cin>>n; if(n%2==1) { cout<<n/2+1; } else { cout<<(n/2+1)+(n/2); }}原创 2020-12-21 20:16:14 · 874 阅读 · 0 评论 -
分数计数
#include<bits/stdc++.h>using namespace std;int a[110];int b[110];int n,c = 0;int main() { cin>>n>>a[1]; for(int i = 2; i <= n; i++) { a[i] = ((a[i-1] * 3703 + 1047) % n) + 1; } for(int i = 1; i <= n; i++) { c++; if(c原创 2020-12-21 20:13:16 · 693 阅读 · 0 评论 -
买木头
#include <bits/stdc++.h>using namespace std;struct node { int len; int num;};node a[10010];int n, m, ma, c;int main () { cin >> n >> m >> a[1].len >> a[1].num; ma = a[1].len; for (int i = 2; i <= n; i ++) { a[i原创 2020-12-21 20:10:14 · 1066 阅读 · 0 评论 -
幸运数字
#include <bits/stdc++.h>using namespace std;int n,i,c;string tos(int n) { string s = ""; while(n != 0) { s = (char)(n % 10 + 48)+ s; n = n / 10; } return s;}int main() { cin>>n; for(i = 1; i <= n; i++) { if(i % 4 == 0||i % 7原创 2020-12-21 20:06:58 · 200 阅读 · 0 评论 -
夏令营小旗手
#include <bits/stdc++.h>using namespace std;int main() { string s; getline(cin,s); int c=0; for(int i=0; i<=s.size()-1; i++) { c=c+s[i]; } cout<<c;}//跳舞的...恶魔!原创 2020-12-21 20:03:25 · 1350 阅读 · 0 评论 -
连续非素数的最长度
#include <bits/stdc++.h>using namespace std;int sushu(int n) { if(n==1) return 0; for(int i=2; i<=sqrt(n); i++) { if(n%i==0) { return 0; } } return 1;}int main() { int n,ma,s=0; cin>>n; ma=0; for(int i=1; i<=n; i++) {原创 2020-12-21 19:59:02 · 853 阅读 · 0 评论 -
奇怪的车牌号
#include<bits/stdc++.h>using namespace std;int main() { int c=0,i,j; for(i=0; i<=6; i++) { for(j=0; j<=6; j++) { if(floor(sqrt(4*i+4*j+12))==sqrt(4*i+4*j+12)) { c++; } } } cout<<c<<endl; return 0;}原创 2020-12-21 19:53:04 · 960 阅读 · 1 评论