CREATE TWO CLASS ONE WITH NAME Person.java AND OTHER WITH WriterReader.java IF YOU WANT YOUR OWN OUTPUT.. THEN REPLACE SAM/LILY NAME WITH YOUR NAME AND RUN WriterReader.java CODE FILE. DOWNLOAD ATTACHMENT FOR ANSWER:
CREATE TWO CLASS ONE WITH NAME Person.java AND OTHER WITH
WriterReader.java
IF YOU WANT YOUR OWN OUTPUT..
THEN REPLACE SAM/LILY NAME WITH YOUR NAME AND RUN WriterReader.java CODE FILE.
#include<bits/stdc++.h> using namespace std; #define ll long long int #define mp make_pair #define pb push_back #define ff first #define ss second #define pii pair<int,int> #define deb(x) cout << #x << " " << x << endl #define all(x) (x).begin(),(x).end() #defineRead more
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define pii pair<int,int>
#define deb(x) cout << #x << ” ” << x << endl
#define all(x) (x).begin(),(x).end()
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(x,start,end) for(auto x=(start)-((start)>(end));x!=(end)-((start)>(end));((start)<(end)?x++:x–))
#include<climits>
const int MOD = 1e9 + 7;
const ll INF = 1e12;
ll mod(ll a) {
if (a >= 0)
return a;
else
return (-1 * a);
}
void swap(ll a, ll b) {
ll temp = a;
a = b;
b = temp;
}
ll power(ll a, ll b) {
ll result = 1;
while (b) {
if (b % 2)
result = (result % MOD) * (a % MOD);
a = ((a % MOD) * (a % MOD)) % MOD;
b = b / 2;
}
return result;
}
bool power_check(ll a) {
bool ans = true;
while (a > 1) {
if (a % 2 == 0) {
a = a / 2;
}
else {
ans = false;
break;
}
}
return ans;
}
void solve() {
unordered_map<string,int> mp;
int n;
cin >>n;
for (int i = 0; i < 3*n; ++i)
{
string s;
cin >> s;
int v;
cin >> v;
mp[s] += v;
}
vector<int> v;
for(auto x:mp){
v.pb(x.second);
}
sort(all(v));
for(int x:v){
cout << x << ” “;
}
cout << endl;
return;
}
int main() {
#ifndef ONLINE_JUDGE
freopen(“input.txt”, “r”, stdin);
freopen(“output.txt”, “w”, stdout);
#endif
fio
//cout << 1000000000 * 1000000000;
int qqq;
cin >> qqq;
//qqq = 1;
while (qqq–) {
solve();
}
//ll ans = 1LL << 64;
//cout << ans << endl;
return 0;
}
//C language answer #include<stdio.h> struct post{ int f; int p; char p_str[105]; }; int place(struct post *pst,struct post temp_post,int p,int q){ int end = q,j,start=0; while(p<=q){ if(temp_post.p < pst[(p+q)/2].p){ p=(p+q)/2 + 1; } else{ q=(p+q)/2 - 1; } } for(j=end;j>=p &&Read more
//C language answer
#include<stdio.h>
struct post{
int f;
int p;
char p_str[105];
};
int place(struct post *pst,struct post temp_post,int p,int q){
int end = q,j,start=0;
while(p<=q){
if(temp_post.p < pst[(p+q)/2].p){
p=(p+q)/2 + 1;
}
else{
q=(p+q)/2 – 1;
}
}
for(j=end;j>=p && j>0;j–){
pst[j]=pst[j-1];
}
pst[p]=temp_post;
return end+1;
}
void display(struct post *posts , int p,int q){
int i;
for(i=p;i<q;i++){
printf(“%s\n”,posts[i].p_str);
}
}
main(){
struct post splist[1000],plist[1000];
int n,m,sp[1000],temp,i,j,s=0,e=0;
scanf(“%d %d”,&n,&m);
for(i=0;i<n;i++){
scanf(“%d”,&temp);
sp[temp]=1;
}
for(j=0;j<m;j++){
struct post temp_post;
scanf(“%d %d %s”,&temp_post.f,&temp_post.p,&temp_post.p_str);
if(sp[temp_post.f]==1)
s=place(splist,temp_post,0,s);
else
e=place(plist,temp_post,0,e);
}
display(splist,0,s);
display(plist,0,e);
}
Numerical and Optimization Techniques
DOWNLOAD PDF FOR ANSWER:
DOWNLOAD PDF FOR ANSWER:
See lessNewton raphson
2
2
See lessWrite a program to read and write an object to file.
CREATE TWO CLASS ONE WITH NAME Person.java AND OTHER WITH WriterReader.java IF YOU WANT YOUR OWN OUTPUT.. THEN REPLACE SAM/LILY NAME WITH YOUR NAME AND RUN WriterReader.java CODE FILE. DOWNLOAD ATTACHMENT FOR ANSWER:
CREATE TWO CLASS ONE WITH NAME Person.java AND OTHER WITH
WriterReader.java
IF YOU WANT YOUR OWN OUTPUT..
THEN REPLACE SAM/LILY NAME WITH YOUR NAME AND RUN WriterReader.java CODE FILE.
DOWNLOAD ATTACHMENT FOR ANSWER:
See lessTotal Correct Submissions
#include<bits/stdc++.h> using namespace std; #define ll long long int #define mp make_pair #define pb push_back #define ff first #define ss second #define pii pair<int,int> #define deb(x) cout << #x << " " << x << endl #define all(x) (x).begin(),(x).end() #defineRead more
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define pii pair<int,int>
#define deb(x) cout << #x << ” ” << x << endl
#define all(x) (x).begin(),(x).end()
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(x,start,end) for(auto x=(start)-((start)>(end));x!=(end)-((start)>(end));((start)<(end)?x++:x–))
#include<climits>
const int MOD = 1e9 + 7;
const ll INF = 1e12;
ll mod(ll a) {
if (a >= 0)
return a;
else
return (-1 * a);
}
void swap(ll a, ll b) {
ll temp = a;
a = b;
b = temp;
}
ll power(ll a, ll b) {
ll result = 1;
while (b) {
if (b % 2)
result = (result % MOD) * (a % MOD);
a = ((a % MOD) * (a % MOD)) % MOD;
b = b / 2;
}
return result;
}
bool power_check(ll a) {
bool ans = true;
while (a > 1) {
if (a % 2 == 0) {
a = a / 2;
}
else {
ans = false;
break;
}
}
return ans;
}
void solve() {
unordered_map<string,int> mp;
int n;
cin >>n;
for (int i = 0; i < 3*n; ++i)
{
string s;
cin >> s;
int v;
cin >> v;
mp[s] += v;
}
vector<int> v;
for(auto x:mp){
v.pb(x.second);
}
sort(all(v));
for(int x:v){
cout << x << ” “;
}
cout << endl;
return;
}
int main() {
See less#ifndef ONLINE_JUDGE
freopen(“input.txt”, “r”, stdin);
freopen(“output.txt”, “w”, stdout);
#endif
fio
//cout << 1000000000 * 1000000000;
int qqq;
cin >> qqq;
//qqq = 1;
while (qqq–) {
solve();
}
//ll ans = 1LL << 64;
//cout << ans << endl;
return 0;
}
ChefWatson uses Social Network
//C language answer #include<stdio.h> struct post{ int f; int p; char p_str[105]; }; int place(struct post *pst,struct post temp_post,int p,int q){ int end = q,j,start=0; while(p<=q){ if(temp_post.p < pst[(p+q)/2].p){ p=(p+q)/2 + 1; } else{ q=(p+q)/2 - 1; } } for(j=end;j>=p &&Read more
//C language answer
#include<stdio.h>
struct post{
int f;
int p;
char p_str[105];
};
int place(struct post *pst,struct post temp_post,int p,int q){
int end = q,j,start=0;
while(p<=q){
if(temp_post.p < pst[(p+q)/2].p){
p=(p+q)/2 + 1;
}
else{
q=(p+q)/2 – 1;
}
}
for(j=end;j>=p && j>0;j–){
pst[j]=pst[j-1];
}
pst[p]=temp_post;
See lessreturn end+1;
}
void display(struct post *posts , int p,int q){
int i;
for(i=p;i<q;i++){
printf(“%s\n”,posts[i].p_str);
}
}
main(){
struct post splist[1000],plist[1000];
int n,m,sp[1000],temp,i,j,s=0,e=0;
scanf(“%d %d”,&n,&m);
for(i=0;i<n;i++){
scanf(“%d”,&temp);
sp[temp]=1;
}
for(j=0;j<m;j++){
struct post temp_post;
scanf(“%d %d %s”,&temp_post.f,&temp_post.p,&temp_post.p_str);
if(sp[temp_post.f]==1)
s=place(splist,temp_post,0,s);
else
e=place(plist,temp_post,0,e);
}
display(splist,0,s);
display(plist,0,e);
}
Max Mex
#include <bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--) { int n,k; cin>>n>>k; int a[1000000],b[n]; for(int i=0;i<1000000;i++) a[i]=0; for(int i=0;i<n;i++) cin>>b[i]; for(int i=0;i<n;i++) { a[b[i]]++; } for(int i=0;i<1000000;i++)Read more
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
See lesscin>>t;
while(t–)
{
int n,k;
cin>>n>>k;
int a[1000000],b[n];
for(int i=0;i<1000000;i++)
a[i]=0;
for(int i=0;i<n;i++)
cin>>b[i];
for(int i=0;i<n;i++)
{
a[b[i]]++;
}
for(int i=0;i<1000000;i++)
{
if(k==0 && a[i]==0)
{
cout<<i<<endl;
break;
}
else if(a[i]==0)
k–;
}
}
return 0;
}