#include <bits/stdc++.h> using namespace std; int main() { int v[10010]; //vector<int>v; int i,j,n,k,max,price1,a,price2,m,diff,tmp; while(cin>>n) { for(i=0;i<n;i++) cin>>v[i]; //v.push_back(i); cin>>m; max=1000000;...
#include <bits/stdc++.h> using namespace std; int main() { int v[10010]; //vector<int>v; int i,j,n,k,max,price1,a,price2,m,diff,tmp; while(cin>>n) { for(i=0;i<n;i++) cin>>v[i]; //v.push_back(i); cin>>m; max=1000000;...
#include <bits/stdc++.h> #define pi 2*acos(0) using namespace std; int main() { double s,a,b,c,tri_area,red_out,red_in; double area_circum,area_inscribed,area_triangle; while(scanf("%lf %lf %lf", &a, &b, &c)==3) { s=(a+b+c)/2;...
#include <stdio.h> int main() { long int dn,r,q; long int bn[10000],i,j; while(1) { scanf("%ld",&dn); if(dn<0) break; else if(dn==0) printf("0\n"); else { q=dn; i=0; while(q>0) { bn[i++]=q%3; q=q/3; } i=i-1; for(j=i;j>=0;j--) printf("%ld",bn[j]);...
#include <bits/stdc++.h> using namespace std; int main() { char s[200]; int n,i,j,l,a; while(cin>>n) { if(n==0) break; scanf("%s",s); l=strlen(s); a=l/n; for(i = 0; i < l; i += a) { for(j = i+a-1; j >= i; j--) printf("%c",s[j]); } puts(""); }...
#include <bits/stdc++.h> using namespace std; int main() { string ch1,ch2; map<string,string>m; int n,l,i,j,k; char c1,c2; cin>>l>>n; for(i=0;i<l;i++) { cin>>ch1>>ch2; m[ch1]=ch2; } for(i=0;i<n;i++){ cin>>ch2;...
#include <bits/stdc++.h> using namespace std; int func_tion(int n) { int j,sum=0; if(n<10) return n; else { for(j=0;; j++) { sum+=n%10; n=n/10; if(n==0) break; } return func_tion(sum); } } int main() { int a,n,res,sum,k; while(cin>>n...
#include<stdio.h> #include<math.h> #include<string.h> #include<iostream> using namespace std; char ch1[10002]; int main() { int n,k,m,value[102],nn; char ch[302]; double s; scanf("%d",&n); while(n--) { s=0;...
#include <bits/stdc++.h> using namespace std; int main() { char m[1002]; int tc, l, n, i, j, r,sum,a[100]; bool flag; cin>>tc; while (tc--) { scanf("\r"); gets(m); l = strlen(m); cin>>n; for (i = 0; i < n; i++) cin>>a[i]; flag...
#include <bits/stdc++.h> using namespace std; int main() { string n,a; long long s,b,c,d,l; while(cin>>n) { sort(n.begin(),n.end()); a=n; if(a[0]=='0') { for(int i=1;i<n.size();i++) { if(a[i]!='0') { swap(a[0],a[i]); break; } } }...
#include <bits/stdc++.h> using namespace std; int main() { int n,a,b,i,j,x,y; bool penalty; while(cin>>n) { if(n==0) break; penalty=false; for(i=1;i<n;i++) { for(j=0;j<=i;j++) { if((i*i*i-j*j*j)==n) { cout<<i<<"...
#include <bits/stdc++.h> using namespace std; int main() { long long int n,m,i,b,count; while(scanf("%lld %lld",&n,&m)==2) { if(n==0 && m==0) break; count=0; for(i=n;i<=m;i++) { b=sqrt(i); if(i==(b*b)) count++; }...
#include <bits/stdc++.h> using namespace std; long int ary[2000007]; int main() { int n,i,j,k; while (scanf("%ld",&n)==1) { if (n==0) { break; } for (i=0;i<n;i++) { scanf("%ld",&ary[i]); } sort(ary,ary+n); for (i=0;i<n;i++) {...
#include<stdio.h> int main() { long int t,a,b,c,i; while(scanf("%ld",&t)==1) { for(i=1; i<=t; i++) { scanf("%ld %ld %ld", &a, &b, &c); if ((a+b)<=c || (b+c)<=a || (c+a)<=b || a<=0 || b<=0 || c<=0) printf("Case %ld:...
#include <bits/stdc++.h> using namespace std; int main() { int x1,x2,y1,y2; while(cin>>x1>>y1>>x2>>y2) { if(x1==0 && y1==0 && x2==0 && y2==0) break; if(x1==x2 and y1==y2) printf("0\n"); else if(...
#include <bits/stdc++.h> using namespace std; int main() { int tc,n,m,x,y; while(cin>>tc) { if(tc==0) break; cin>>n>>m; for(int i=0;i<tc;i++) { cin>>x>>y; if(x==n || y==m) cout<<"divisa\n"; else if(x>n and...
#include<bits/stdc++.h> using namespace std; int main() { char l,s[105]; int c,j,t,i; scanf("%d%*c",&t); for(i=1;i<=t;i++) { c=0; gets(s); l=strlen(s); for(j=0;j<l;j++) {...
#include <bits/stdc++.h> using namespace std; int main() { int tc,cases=0,j,r; char s[1000],c; cin>>tc; while(tc--) { scanf("\r"); gets(s); int l=strlen(s); printf("Case %d: ",++cases); for(int i=0;i<l;i++) { r=0;...
#include <bits/stdc++.h> using namespace std; int main() { int t = 0,i,n; cin >> t; while(t--) { int n = 0; cin >> n; n *= 567; n /= 9; n += 7492; n *= 235; n /= 47; n-= 498; n/=10; n%=10; printf("%d\n",abs(n)); } return 0; }...
struct and union in C These both declare same and uses are almost same; just the difference when use struct then need to declare with ‘struct’ keyword struct student { int roll; float age; }; when use union then declare as union student { int roll; float age;...
#include <bits/stdc++.h> using namespace std; int main() { int p,b,h,w,price,i,a,j,s; while(scanf("%d %d %d %d",&p,&b,&h,&w)==4) { int cost=15000000; for(i=0;i<h;i++) { scanf("%d",&price); for(j=0;j<w;j++) { scanf("%d",&a);...
Stay ahead in web development with a weekly dive into PHP news, articles, events, and essential links. Discover the power of continuous learning for PHP professionals.
Discover expert strategies and essential resources to ace the IELTS Speaking Test. Learn how to boost your fluency, vocabulary, and confidence for a top score.
Get ready for Java 25! The September 2025 Inside Java Newsletter is packed with technical videos, Java User Group updates, and essential developer event news. Stay ahead with the latest Java innovations.
Explore how AI tools like ChatGPT are reshaping education, from aiding learning to challenging academic integrity, especially in the realm of college application essays.