A:
给一组数字,判断是否满足以下条件
1 #define _CRT_SECURE_NO_WARNINGS 2 #include<algorithm> 3 #include<iostream> 4 #include<cstring> 5 #include<cstdio> 6 #include<cmath> 7 #include<vector> 8 using namespace std; 9 typedef long long LL; 10 typedef pair<int, int> PII; 11 typedef pair<LL, LL> PLL; 12 typedef unsigned long long ULL; 13 const LL N = 2e5 + 10, MOD = 1e9 + 7; 14 void solve() 15 { 16 int a[10]; 17 for (int i = 1; i <= 8; ++i) 18 scanf("%d", &a[i]); 19 for (int i = 1; i < 8; ++i) 20 { 21 if (a[i] > a[i + 1]) 22 { 23 printf("No\n"); 24 return; 25 } 26 } 27 for (int i = 1; i <= 8; ++i) 28 { 29 if (a[i] < 100 || a[i]>675 || a[i] % 25) 30 { 31 printf("No\n"); 32 return; 33 } 34 } 35 printf("Yes\n"); 36 return; 37 } 38 int main() 39 { 40 int T = 1; 41 //canf("%d", &T); 42 while (T--) 43 { 44 solve(); 45 } 46 return 0; 47 }View Code
B:
吃饭,第一行给出他总共吃的盘子颜色,第二行给出有些颜色的盘子的价格,第三行给出其他颜色盘子的价格p0和固定颜色盘子的价格
1 #include<bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 const int mxn=1e3+6; 5 6 int n,m; 7 string c[105],d[105]; 8 int p[105]; 9 map<string,int>mp; 10 11 int main() 12 { 13 std::ios::sync_with_stdio(false); 14 cin.tie(0),cout.tie(0); 15 cin>>n>>m; 16 for(int i=1;i<=n;i++)cin>>c[i]; 17 for(int i=1;i<=m;i++)cin>>d[i],mp[d[i]]=i; 18 for(int i=0;i<=m;i++)cin>>p[i]; 19 ll ans=0; 20 for(int i=1;i<=n;i++){ 21 ll tmp=p[0]; 22 if(mp.count(c[i]))tmp=p[mp[c[i]]];//youjiageduanwei 23 ans+=tmp; 24 } 25 cout<<ans<<'\n'; 26 }View Code
C: