第二天小测
Fishlinsihan · · 个人记录
include <iostream>
using namespace std;
int main() { std::ios::sync_with_stdio(0); std::cin.tie(0); std::cout.tie(0);
int a, b, c, d, x;
cin >> a >> b >> c >> d >> x;
int ans = 0;
if (x >= a)
{
ans += b;
}
if (x >= c)
{
ans += d;
}
cout << ans << "\n";
return 0;
}
include <iostream>
using namespace std;
int main() { std::ios::sync_with_stdio(0); std::cin.tie(0); std::cout.tie(0);
int a[6], b[6];
for (int i = 1; i <= 4; i++)
{
cin >> a[i];
}
for (int i = 1; i <= 4; i++)
{
cin >> b[i];
}
int ans = 0;
for (int i = 1; i <= 4; i++)
{
for (int j = i + 1; j <= 4; j++)
{
if (a[i] < a[j] && b[i] > b[j] || a[i] > a[j] && b[i] < b[j])
{
ans++;
}
}
}
cout << ans << "\n";
return 0;
}
include <iostream>
include <iomanip>
using namespace std;
int main() { std::ios::sync_with_stdio(0); std::cin.tie(0); std::cout.tie(0);
int n;
cin >> n;
for (int i = 1; i <= n; i++)
{
int t, a = 0, x;
cin >> t;
for (int j = 1; j <= t; j++)
{
cin >> x;
if (x == 0)
a++;
}
cout << fixed << setprecision(7) << 1.0 * a / t << "\n";
}
return 0;
}
include <iostream>
using namespace std;
int T,n;
int main() { cin>>T; while(T--) { cin>>n; bool flag=0; for(int i=1,x;i<=n;i++) { cin>>x; if(x==0)flag=1; } if(flag==1)cout<<"yes\n"; else cout<<"no\n"; }
return 0;
}
include <iostream>
using namespace std;
int main() { string s; cin >> s; int len = s.size(); s += "1234567"; int cnt = 0; for (int i = 0; i < len; i++) { string t = s.substr(i, 6); if (t == "friend") { cnt++; s[i + 5] = 'l'; s[i + 6] = 'o'; s[i + 7] = 'v'; s[i + 8] = 'e'; } } cout << cnt << "\n"; return 0; }