cin何奇怪?
  • 板块学术版
  • 楼主ltm_soviet
  • 当前回复6
  • 已保存回复6
  • 发布时间2025/6/22 21:28
  • 上次更新2025/6/23 21:28:23
查看原帖
cin何奇怪?
1383031
ltm_soviet楼主2025/6/22 21:28

rt
在做P5744时,突然心血来潮,在开头放上了

ios::sync_with_stdio(false);
cin.tie(0);

然后

R221225426

#include<bits/stdc++.h>
using namespace std;
#define itn int
// #define int long long
#define scnaf scanf
// struct stu
// {
//     string name;
//     int age;
//     int noip;
// }x;
signed main()
{ 
    //freopen("P____.in","r",stdin);
    // freopen("P____.out","w",stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    scanf("%d",&n);
    while(n--)
    {
        string name;
        int age,noip;
        cin>>name>>age>>noip;
        printf("%s %d %d\n",name.c_str(),age+1,((noip*120/100)>=600)?600:(noip*120/100));
    }

    return 0;
}

把它注释掉后

R221225435

#include<bits/stdc++.h>
using namespace std;
#define itn int
// #define int long long
#define scnaf scanf
// struct stu
// {
//     string name;
//     int age;
//     int noip;
// }x;
signed main()
{ 
    //freopen("P____.in","r",stdin);
    // freopen("P____.out","w",stdout);
    // ios::sync_with_stdio(false);
    // cin.tie(0);
    int n;
    scanf("%d",&n);
    while(n--)
    {
        string name;
        int age,noip;
        cin>>name>>age>>noip;
        printf("%s %d %d\n",name.c_str(),age+1,((noip*120/100)>=600)?600:(noip*120/100));
    }

    return 0;
}

很想知道为什么(ο´・д・)??

2025/6/22 21:28
加载中...