Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- ifstream fin("toate.in");
- ofstream fout("toate.out");
- int n, x, xnou, xmax;
- int main()
- {
- fin>>n;
- for(int i=1; i<=n; ++i)
- {
- fin>>x;
- int p=1;
- xnou=0;
- while(x)
- {
- if(x%10!=9)
- {
- xnou=xnou+(x%10)*p;
- p*=10;
- }
- x/=10;
- }
- if(xnou>xmax)
- xmax=xnou;
- }
- fout<<xmax;
- return 0;
- }
- /**
- SO
- #include <fstream>
- using namespace std;
- ifstream f("toate.in");
- ofstream g("toate.out");
- int n,i,a,x,p,r,maxim;
- int main()
- {
- f >> n;
- maxim = 0;
- for(i = 1; i <= n; i++)
- {
- f >> x;
- a = 0;
- p = 1;
- while(x != 0)
- {
- r = x % 10;
- if(r != 9)
- {
- a = a + r * p;
- p = p * 10;
- }
- x = x / 10;
- }
- if(a > maxim)
- maxim = a;
- }
- g << maxim;
- return 0;
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement