#include<bits/stdc++.h> using namespace std; int main() { int x,y; while(cin>>x>>y) { int c=x^y; cout<<c<<endl; } return 0; }
Thursday, October 13, 2016
UVa 10469 - To Carry or not to Carry
Tuesday, October 4, 2016
CF 723A
#include<bits/stdc++.h> using namespace std; int main() { int x,xx,xxx; cin>>x>>xx>>xxx; int result = (max(x,max(xx,xxx))) -( min(x,min(xx,xxx))); cout<<result<<endl; return 0; }
Sunday, October 2, 2016
Link List - Insertion and Print inserted data
#include<bits/stdc++.h> using namespace std; struct node { int data; int key; struct node *next; }; struct node *head = NULL; struct node *current = NULL; void InsertFirst(int key,int data) { struct node *link = (struct node*) malloc(sizeof(struct node)); link->key=key; link->data=data; link->next = head; head = link; } void printList() { struct node *ptr=head; while(ptr != NULL) { cout<<"("<<ptr->key<<","<<ptr->data<<")"; ptr=ptr->next; } cout<<endl; } int main() { int data,key; for(int i=0; i<4; i++) { cin>>data>>key; InsertFirst(data,key); } printList(); return 0; }
Subscribe to:
Posts (Atom)