10 条题解
-
2赵青海 (huhe) LV 7 SU @ 2024-11-15 20:24:12
#include <stdio.h> #include <iostream> #include <string.h> using namespace std; char a[100000],b[100000]; int main() { cin.getline(a,100000); int len = strlen(a); a[len]= ' '; int num = 0 , flag = 0; for(int i = 0 ; i <= len ; i++) { if(a[i] != ' ') num++; else if(num != 0) { if(flag) cout << ","; cout << num; flag = 1; num = 0; } } }
-
12024-1-30 11:19:46@
#include<cmath> #include<iomanip> #include <cstring> using namespace std; int INF=0x3f3f3f3f; const int N=1e3+10; int ans; bool f; char a[N]; int main() { while(cin>>a) { if(f) { cout<<","; } else { f=1; } int len=strlen(a); cout<<len; } return 0; } ` | col1 | col1 | col1 | col2 | col3 | | --- | --- | --- | | | | | | | | | | col2 | col3 | | --- | --- | --- | | | | | | | | | | col2 | col3 | | --- | --- | --- | | | | | | | | |`
-
12023-5-17 20:25:38@
#include<iostream> #include<cmath> #include<iomanip> #include <cstring> using namespace std; int INF=0x3f3f3f3f; const int N=1e3+10; int ans; bool f; char a[N]; int main() { while(cin>>a) { if(f) { cout<<","; } else { f=1; } int len=strlen(a); cout<<len; } return 0; }
-
12023-4-16 19:39:35@
#include <bits/stdc++.h> using namespace std; string s; int dc[305],z=0,d=0; int main() { memset(dc,0,sizeof(dc)); getline(cin,s); for(int i=0; i<s.size(); i=i+1) { if(s[i]!=' ')d=d+1; else { if(d!=0) { z=z+1; dc[z]=d; d=0; } } } if(d>0) { z=z+1; dc[z]=d; } printf("%d",dc[1]); for(int i=2; i<=z; i=i+1)printf(",%d",dc[i]); return 0; }
-
12023-1-22 22:36:59@
#include <bits/stdc++.h> using namespace std; string s; int dc[305],z=0,d=0; int main() { memset(dc,0,sizeof(dc)); getline(cin,s); for(int i=0; i<s.size(); i=i+1) { if(s[i]!=' ')d=d+1; else { if(d!=0) { z=z+1; dc[z]=d; d=0; } } } if(d>0) { z=z+1; dc[z]=d; } printf("%d",dc[1]); for(int i=2; i<=z; i=i+1)printf(",%d",dc[i]); return 0; }
-
02023-9-17 19:37:18@
#include <iostream> #include <bits/stdc++.h> using namespace std; const int N=1e7+10; const int INF=0x3f3f3f3f; char a[505]; bool f=0; int main() { while(cin>>a) { if(f==1) { cout<<","<<strlen(a); } else { cout<<strlen(a); f=1; } } }
-
02022-4-21 20:55:18@
#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
char a[1001];
int n,s;
int main(){
gets(a);//输入 n=strlen(a);//长度 for(int i=0;i<n;i++) { if(a[i]==' ') { if(s>0) printf("%d,",s); s=0; } else s++; } printf("%d",s); return 0;
}
//75分代码,求改正
-
-12022-10-24 23:05:02@
#include<iostream> #include<algorithm> using namespace std; int main(){ string str; int first=0; while(cin>>str){ if(first==1) cout<<","; first=1; cout<<str.size(); } return 0; }
-
-12022-1-23 20:09:46@
#include <bits/stdc++.h> using namespace std; int main() { string s; bool flag = true; while (cin >> s) { if (flag) { flag = false; cout << s.size(); } else { cout << ',' << s.size(); } } return 0; }
-
-12021-10-9 20:19:50@
#include<iostream> #include<string.h> using namespace std; int main() { char a[1001]; cin.getline(a,1001); int len=strlen(a); int flag=1; int num=0; for(int i=0;i<len;i++) { if(a[i]!=' ') num++; else if(i>0) { if(a[i-1]' ') continue; if(flag0) cout<<","; flag=0; cout<<num; num=0; } } if(num != 0) { if(flag==0) cout<<","; cout<<num; } }
- 1
信息
- ID
- 1095
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 6
- 标签
- 递交数
- 693
- 已通过
- 219
- 上传者