Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- #include <cstring>
- const int N(100);
- char str[N];
- int main(){
- int len = strlen(gets(str));
- int now = 0;
- int hh, mm;
- while(now < len){
- while(now < len and *(str + now) == ' ') ++now;
- if(now == len) break;
- if(sscanf(str + now, "%d:%d", &hh, &mm) < 1) break;
- printf("get %02d:%02d\n", hh, mm);
- char* next = strstr(str + now, " ");
- if(next == 0) break;
- now = next - str;
- }
- sprintf(str, "%d+%d=%d", hh, mm, hh + mm);
- printf("%s", str);
- return 0;
- }
- /*
- 23:58 43:12 02:43 1:32
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement