mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
Create 1760.c
This commit is contained in:
parent
7f885cf820
commit
f64e4595d2
33
QUSTOJ/1760.c
Normal file
33
QUSTOJ/1760.c
Normal file
|
@ -0,0 +1,33 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
char pool[1024];
|
||||
int vec[1024];
|
||||
int cnt=0;
|
||||
|
||||
int main()
|
||||
{
|
||||
gets(pool);
|
||||
int L=strlen(pool);
|
||||
int starti=0;
|
||||
int endi=0;
|
||||
for(int i=0;i<L;i++)
|
||||
{
|
||||
starti=i;
|
||||
while(pool[i]>='0'&&pool[i]<='9')
|
||||
{
|
||||
endi=++i;
|
||||
}
|
||||
if(starti<endi)
|
||||
{
|
||||
sscanf(pool+starti,"%d",&vec[cnt++]);
|
||||
}
|
||||
}
|
||||
printf("num=%d\n",cnt);
|
||||
for(int i=0;i<cnt-1;++i)
|
||||
{
|
||||
printf("%d ",vec[i]);
|
||||
}
|
||||
return printf("%d\n",vec[cnt-1]),0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user