We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1935279 commit be10c11Copy full SHA for be10c11
Greedy-Algorithms/Greedy-PP2.c
@@ -0,0 +1,37 @@
1
+#include<stdio.h>
2
+void sort(int a[],int n)
3
+{
4
+ int t;
5
+ for(int i=0;i<n-1;i++)
6
+ {
7
+ for(int j=0;j<n-1-i;j++)
8
9
+ if(a[j]>a[j+1])
10
11
+ t=a[j];
12
+ a[j]=a[j+1];
13
+ a[j+1]=t;
14
+ }
15
16
17
+}
18
+int main()
19
20
+ int n,c,ans=0;
21
+ scanf("%d",&n);
22
+ int g[n];
23
+ for(int i=0;i<n;i++)
24
+ scanf("%d",&g[i]);
25
+ scanf("%d",&c);
26
+ int s[c];
27
+ for(int i=0;i<c;i++)
28
+ scanf("%d",&s[i]);
29
+ sort(g,n);
30
+ sort(s,c);
31
32
33
+ if(s[i] >= g[i])
34
+ ans++;
35
36
+ printf("%d",ans);
37
0 commit comments