UVA 12403 - Save Setu Solution
#include<iostream>
#include<cstring>
#include<cstdio>
#include<string>
#include<string.h>
using namespace std;
int main()
{
int a,t,i,j;
int sum=0;
char word[100];
cin>>t;
while(t--)
{
cin>>word;
if(strcmp(word,"donate")==0)
{
cin>>a;
sum=sum+a;
}
else cout<<sum<<endl;
}
return 0;
}
Problem Link : https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=3834
#include<iostream>
#include<cstring>
#include<cstdio>
#include<string>
#include<string.h>
using namespace std;
int main()
{
int a,t,i,j;
int sum=0;
char word[100];
cin>>t;
while(t--)
{
cin>>word;
if(strcmp(word,"donate")==0)
{
cin>>a;
sum=sum+a;
}
else cout<<sum<<endl;
}
return 0;
}
Problem Link : https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=3834
No comments:
Post a Comment
Thank you for commenting. Please wait for response :)