There are K tiles. Each of the tiles either contains a single uppercase Latin letter or is a blank tile meaning that it can represent any uppercase Latin letter.
Given is also a graph with N nodes and M edges. Initially, some of the nodes contain tiles. The rest of the nodes are unoccupied.
Find the sequential letters in order.
#include <iostream>
using namespace std;
int main() {
int n,*arr,search;
cin>>n;
arr = new int[n];
for(int i = 0;i<n;i++){
cin>>arr[i];
}
cin>>search;
cout<<"Sequential file\n";
for(int i = 0;i<n;i++){
if(search==arr[i]){
cout<<search<<" found at location "<<i+1<<endl;
break;
}
}
return 0;
}
Given is also a graph with N nodes and M edges. Initially, some of the nodes contain tiles. The rest of the nodes are unoccupied.
Find the sequential letters in order.
#include <iostream>
using namespace std;
int main() {
int n,*arr,search;
cin>>n;
arr = new int[n];
for(int i = 0;i<n;i++){
cin>>arr[i];
}
cin>>search;
cout<<"Sequential file\n";
for(int i = 0;i<n;i++){
if(search==arr[i]){
cout<<search<<" found at location "<<i+1<<endl;
break;
}
}
return 0;
}
Comments
Post a Comment