专栏文章

第二天小测

个人记录参与者 1已保存评论 0

文章操作

快速查看文章及其快照的属性,并进行相关操作。

当前评论
0 条
当前快照
1 份
快照标识符
@miqb0jif
此快照首次捕获于
2025/12/04 01:51
3 个月前
此快照最后确认于
2025/12/04 01:51
3 个月前
查看原文
#include using namespace std;
int main() { std::ios::sync_with_stdio(0); std::cin.tie(0); std::cout.tie(0);
CPP
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 using namespace std;
int main() { std::ios::sync_with_stdio(0); std::cin.tie(0); std::cout.tie(0);
CPP
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 #include using namespace std;
int main() { std::ios::sync_with_stdio(0); std::cin.tie(0); std::cout.tie(0);
CPP
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 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"; }
CPP
return 0;
}
#include 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; }

评论

0 条评论,欢迎与作者交流。

正在加载评论...