xxxxxxxxxx
#include<stdio.h>
using namespace std;
void main()
{
for (int i=1, i<=5, i++)
{
for(int j=1, j<=i,j++)
{
printf("%c",64+j)
}
printf("\n")
}
}
xxxxxxxxxx
#include<iostream>
using namespace std;
#include<bits/stdc++.h>
int has1[26],has2[26];
int main()
{
int n;
cin>>n;
char ff[n+10],ss[n+10];
for(int i=0;i<n/2;i++)
{
cin>>ff[i];
has1[ff[i]-'a']++;
}
for(int i=0;i<n/2;i++)
{
cin>>ss[i];
has2[ss[i]-'a']++;
}
sort(ff,ff+n/2);
sort(ss,ss+n/2);
//case 1
int ans1=0,ans2=0,ans3=0;
for(int i=0;i<26;i++)
{
ans1+=abs(has1[i]-has2[i]);
// cout<<"i " <<i<<" " <<has1[i]<<" " <<has2[i]<<endl;
}
int i=0,j=0;
while(i!=n/2 && j!=n/2)
{
if(ff[i]<ss[j])
{
i++;
j++;
}
else
j++;
}
ans2=abs(j-i);
i=0,j=0;
while(i!=n/2 && j!=n/2)
{
if(ss[i]<ff[j])
{
i++;
j++;
}
else
j++;
}
ans3=abs(j-i);
// cout<<ans1<<" "<<ans2<<" "<<ans3<<endl;
cout<<min(min(ans1/2,ans2),ans3);
return 0;
}
xxxxxxxxxx
# Importing
import sklearn
from sklearn.datasets import load_boston
import pandas as pd
import matplotlib.pyplot as plt
# Load the dataset
bos_hou = load_boston()
# Create the dataframe
column_name = bos_hou.feature_names
df_boston = pd.DataFrame(bos_hou.data)
df_boston.columns = column_name
df_boston.head()
xxxxxxxxxx
"""
coronavirus
3
abcde
crnas
onarous
"""
# Iterative Python program to check if a
# string is a subsequence of another string
# Returns true if str1 is a subsequence of str2
def main(str1, str2):
m = len(str1)
n = len(str2)
j = 0 # Index of str1
i = 0 # Index of str2
# Traverse both str1 and str2
# Compare the current character of str2 with
# first unmatched character of str1
# If matched, then move ahead in str1
while j < m and i < n:
if str1[j] == str2[i]:
j = j+1
i = i + 1
# If all characters of str1 matched,
# then j is equal to m
return j == m
# Driver Program
str2 = str(input())
N = int(input())
for i in range(N):
str1 = str(input())
if main(str1, str2):
print("POSITIVE")
else:
print( "NEGATIVE")
xxxxxxxxxx
#include <stdio.h>
int main()
{
int n,np=0,i,j,flag=0;
scanf("%d",&n);
for(i=2;i<=n;i++)
{
for(j=1,flag=0;j<=i;j++)
{
if(i%j==0)
flag++;
}
if(flag==2)
np++;
}
int total=n-2+1;
for(i=total/2;i>=1;i--)
if(total%i==0&&np%i==0)
{
total/=i;
np/=i;
}
printf("%d/%d",np,total);
return 0;
}
xxxxxxxxxx
#include <stdio.h>
int main()
{
char name [20] = "Lakshmisprasad";
char email [40]="lakshmiprasad018@gmail.com";
char slack[10]="@lakshmip";
char twitter[20]="Lakshmip2798";
char biostack [20]="Functional Genomics";
printf("name:%s\nemail:%s\ntwitter:%s\nbiostack:%s\nslack:%s\n",name,email,twitter,biostack, slack );
return 0;
}
xxxxxxxxxx
#include<stdio.h>
#include<conio.h>
void main()
{
int rows,i,j,k=0;
printf("Enter number of rows: ");
scanf("%d",&rows);
for(i=1;i<=rows;i++)
{
for(j=1;j<=i;++j)
printf("%d ",k+j);
++k;
printf("\n");
}
getch();
}
xxxxxxxxxx
float(input("Digite quantos litros você quer abastecer: "))
input("Digite A para álcool ou G para gasolina: ")
if combustivel == "A" or combustivel == "a":
preco = litros * 1.9
if litros <= 20:
preco -= 1.9 * litros * 3 / 100
else:
preco -= 1.9 * litros * 5 / 100
elif combustivel == "G" or combustivel == "g":
preco = litros * 2.5
if litros <= 20:
preco -= 2.5 * litros * 4 / 100
else:
preco -= 2.5 * litros * 6 / 100
print(f"O preço a pagar é R${preco:.2f}")
xxxxxxxxxx
include<stdio.h>
int get_palindrome_time(char str[])
{
int hh, mm;
hh = (str[0] - 48) * 10 + (str[1] - 48);
mm = (str[3] - 48) * 10 + (str[4] - 48);
int requiredTime = 0;
while (hh % 10 != mm / 10 || hh / 10 != mm % 10)
{
++mm;
if (mm == 60)
{
mm = 0;
++hh;
}
if (hh == 24)
hh = 0;
++requiredTime;
}
return requiredTime;
}
int main()
{
char str[6];
scanf("%s",str);
printf("%d",get_palindrome_time(str));
}
xxxxxxxxxx
include<stdio.h>
int get_palindrome_time(char str[])
{
int hh, mm;
hh = (str[0] - 48) * 10 + (str[1] - 48);
mm = (str[3] - 48) * 10 + (str[4] - 48);
int requiredTime = 0;
while (hh % 10 != mm / 10 || hh / 10 != mm % 10)
{
++mm;
if (mm == 60)
{
mm = 0;
++hh;
}
if (hh == 24)
hh = 0;
++requiredTime;
}
return requiredTime;
}
int main()
{
char str[6];
scanf("%s",str);
printf("%d",get_palindrome_time(str));
}