Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///Indicatie
- ///Se consideră graful orientat corespunzător arcelor formate din pozițiile elementelor permutării și valorile acestora.
- #include <fstream>
- #include <cmath>
- using namespace std;
- ifstream f("permutarepow.in");
- ofstream g("permutarepow.out");
- int main()
- {
- int n,x,sol=0;
- f>>n;
- for(int i=1;i<=n;++i)
- {
- f>>x;
- x=abs(1-x)+1;
- if(x>sol)
- sol=x;
- }
- g<<sol;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement