From c5fcf7179a83ef65c86c6a4a390029149e518649 Mon Sep 17 00:00:00 2001 From: Franciszek Malinka Date: Tue, 5 Oct 2021 21:49:54 +0200 Subject: Duzy commit ze smieciami --- semestr-4/sieci/warsztaty8/dat0-check.cpp | 58 +++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 semestr-4/sieci/warsztaty8/dat0-check.cpp (limited to 'semestr-4/sieci/warsztaty8/dat0-check.cpp') diff --git a/semestr-4/sieci/warsztaty8/dat0-check.cpp b/semestr-4/sieci/warsztaty8/dat0-check.cpp new file mode 100644 index 0000000..3ca4111 --- /dev/null +++ b/semestr-4/sieci/warsztaty8/dat0-check.cpp @@ -0,0 +1,58 @@ +//Krzysztof Boryczka +#include +using namespace std; + +typedef long long ll; +typedef long double ld; +typedef pair ii; +typedef vector vi; +typedef vector vii; +const int inf=0x3f3f3f3f; +const ll INF=0x3f3f3f3f3f3f3f3f; + +#define FOR(i, b, e) for(int i=b; i<=e; i++) +#define FORD(i, b, e) for(int i=b; i>=e; i--) +#define SIZE(x) ((int)x.size()) +#define pb push_back +#define st first +#define nd second +#define sp ' ' +#define ent '\n' + +ifstream out, wzor, in; + +int main(int argc, char *argv[]){ + assert(argc>=4); + + out.open(argv[1]); + wzor.open(argv[2]); + in.open(argv[3]); + + vector ans, user; + string pom; + while(wzor>>pom) ans.pb(pom); + while(out>>pom) user.pb(pom); + FOR(i, 1, 5) in>>pom; + + if(ans!=user) + { + if(pom != "0" && pom != "1" && pom != "3" && pom != "5"){ + cout << "Zla odpowiedz\n"; + exit(1); + } + int d=0, g=0, m=0, s=0; + FOR(i, 0, SIZE(ans)-1){ + if(ans[i][0]=='d') d=stoi(ans[i-1]); + if(ans[i][0]=='g') g=stoi(ans[i-1]); + if(ans[i][0]=='m') m=stoi(ans[i-1]); + if(ans[i][0]=='s') s=stoi(ans[i-1]); + } + if(SIZE(user)!=4 || stoi(user[0])!=d || stoi(user[1])!=g || stoi(user[2])!=m || stoi(user[3])!=s){ + cout << "Zla odpowiedz\n"; + exit(1); + } + } + + cout << "OK\n"; + exit(0); +} -- cgit v1.2.3