Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Rezolvare
#include <iostream> #include <fstream> using namespace std; ifstream f("bac.txt"); int s,sprecedent; int main() { int x,i=2,maxim=0,inceput,final,inceputSnoua; cin>>x; maxim=x; sprecedent=x; while(cin>>x)//f>>x { if(sprecedent+x>x) s=sprecedent+x; else { s=x; inceputSnoua=i; } if(s>maxim) { inceput=inceputSnoua; maxim=s; final=i; } sprecedent=s; i++; } cout<<maxim<<endl; cout<<"Inceput: "<<inceput<<" Final: "<<final; return 0; }
run
|
edit
|
history
|
help
0
Bank System
c++ car racing game
Web Browser History
For Hello World
diamond
pointer
Binary Search
Virtuals
cast
https://codeforces.com/contest/449/problem/D (INCLuSION EXCLUSION principle)