huanghao666 题目问答 · 2026/3/30
求组
这道题怎么没有题解
1 1 1 14
伊人浅笑24y3r 题目问答 · 2026/3/15
数据问题
数据不对,长点心吧
5 0 0 53
justAman 题目问答 · 2026/3/24
为何逻辑相似,只是换用了数据输入方式,就能AC?
下面这是我让AI写的代码,后面接着我的代码,看着除了输入方式不一样之外,好像就没什么差别了,想不明白为什么我自己的代码AC不了,AI的却可以。。。。求大佬解答,感谢 ```cpp #include <iostream> #include <vector> #include <string> #include <algorithm> using namespace std; struct Student { string name; int id; string className; }; // 比较函数 bool compare(const Student& lhs, const Student& rhs) { if (lhs.className != rhs.className) { return lhs.className < rhs.className; } return lhs.id < rhs.id; } int main() { // 优化 I/O 速度 ios::sync_with_stdio(false); cin.tie(0); int n; // 尝试处理多组输入,防止 WA while (cin >> n) { vector<Student> students(n); for (int i = 0; i < n; ++i) { cin >> students[i].name >> students[i].id >> students[i].className; } sort(students.begin(), students.end(), compare); for (const auto& s : students) { cout << s.name << " " << s.id << " " << s.className << endl; } } return 0; } ``` ```cpp #include <cstdio> #include "string" #include "vector" #include "algorithm" using namespace std; struct Student{ string name; int id; string className; Student(char *_name, int _id, char *_className){ name = _name; id = _id; className = _className; } }; bool compare(Student lhs, Student rhs){ if(lhs.className < rhs.className) return true; else if(lhs.className == rhs.className && lhs.id < rhs.id) return true; else return false; } int main() { vector<Student> students; int n, id; char buffer_name[50], buffer_className[50]; while (scanf("%d", &n) != EOF){ students.clear(); while (n --){ scanf("%s %d %s", buffer_name, &id, buffer_className); students.emplace_back(buffer_name, id, buffer_className); } sort(students.begin(), students.end(), compare); for(auto each: students){ printf("%s %d %s\n", each.name.c_str(), each.id, each.className.c_str()); } } return 0; } ```
查看全文
2 0 0 26
nameless 题目问答 · 2026/2/17
数据弱了
如题。AC代码可以去蓝桥官网测试一下,地址
2 0 0 48
nameless 题目问答 · 2025/3/18
数据不够全面,望加强
如题
1 0 0 515
重生之苦钻算法 题目问答 · 2025/3/14
为什么我这个代码在蓝桥那能通过,在这通过不了
```cpp #include <bits/stdc++.h> using namespace std; using ll = long long; int n, m; ll a[300010], diff[300010], sum[300010], lt[300010], rt[300010]; int main() { ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); cin >> n >> m; ll count = 0; for (int i = 1; i <= m; ++i) { cin >> lt[i] >> rt[i]; diff[lt[i]] += 1; diff[rt[i]+1] -= 1; } for (int i = 1; i <= n; ++i) { a[i] = a[i-1] + diff[i]; sum[i] = a[i] == 1 ? sum[i-1] + 1 : sum[i-1]; if (a[i] == 0) count++; } for (int i = 1; i <= m; ++i) { cout << count + sum[rt[i]] - sum[lt[i]-1] << '\n'; } return 0; } ```
查看全文
1 0 0 523
ea123 题目问答 · 2024/4/23
数据真的没问题吗
感觉不知道哪里写错了,一组数据都没过
9 0 0 105
烟火易冷oei4s 题目问答 · 2025/9/3
求解代码问题,通过了三个案例
```c [[ int uniquely(MGraph G) { int v=G.numberVertices; if (v==0) return 1; int i=0,j=0,k=0,flag=-1; for(k=0;k<v;v++){ flag=-1; for(i=0;i<v;i++){ for(j=0;j<v;j++){ if(G.edge[j][i]) break; } if(j==v){ if (flag!=-1) return 0; flag=i; } } if(flag==-1) return 0; for(int i=0;i<v;i++){ G.edge[flag][i]=0; } } return 1; } ```
查看全文
1 0 0 42
潇潇雨未歇 题目问答 · 2024/12/6
问题出在哪了捏
```cpp #include<bits/stdc++.h> using namespace std; int m1[]={0,1,3,5,7,8,10,12};//数组m1存储大月 int m2[]={0,4,6,9,11};//数组m2存储小月 map<int,int> bh={{0,13},{1,1},{2,2},{3,3},{4,5},{5,4},{6,4},{7,2},{8,2},{9,2}}; int sum(int year,int month,int day){ int y1=year%10,y2=year%100,y3=year%1000,y4=year/1000; int m1=month%10,m2=month/10; int d1=day%10,d2=day/10; int n=0; n=bh[y1]+bh[y2]+bh[y3]+bh[y4]+bh[m1]+bh[m2]+bh[d1]+bh[d2]; return n; } int main(){ int num=0; int year=2000,month=1,day=1; int year2=2024,month2=4,day2=13; while(1){ if(sum(year,month,day)>50) num++; day++; for(int j=1;j<=7;j++){ if(month==m1[j]&&day==32){ month++; day=1; break; } } for(int j=1;j<=4;j++){ if(month==m2[j]&&day==31){ month++; day=1; break; } } if(month==2){ if((year%4==0&&year%100!=0)||year%400==0){ if(day==30){ month++; day=1; } }else{ if(day==29){ month++; day=1; } } } if(month==13){ month=1; year++; } if(year==year2&&month==month2&&day==day2) break; } cout<<num<<endl; return 0; } ```
查看全文
2 0 0 513
木子里的李 题目问答 · 2025/3/17
怎么过不了的?哪里错了?
``` #include <iostream> #include <vector> using namespace std; const int MOD = 1e9 + 7; long long fast_pow(long long x, long long y, long long mod) { long long res = 1; while (y > 0) { if (y & 1) res = res * x % mod; x = x * x % mod; y >>= 1; } return res; } int main() { int n, q; cin >> n >> q; long long sum = 0; vector<long long>v(n); for (int i = 0; i < n; i++) { cin >> v[i]; sum = (sum + v[i]) % MOD; } int l = 0, index; while(q--) { cin >> index; index--; //可能导致负数 //sum = sum * 2 % MOD - fast_pow(v[index], 2 * l, 1e9+7); sum = (sum * 2 - v[index] * fast_pow(2, l, MOD) % MOD + MOD) % MOD; l++; } cout << sum; return 0; } ```
查看全文
0 0 0 501