Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- using namespace std;
- ifstream cin("subsecv.in");
- ofstream cout("subsecv.out");
- int n,a[10001];
- int main()
- {
- int s;
- cin>>n;
- for(int i=1;i<=n;i++)
- cin>>a[i];
- for(int i=1;i<=n;i++)
- {
- s=a[i];
- if(s%n==0)
- {
- cout<<i<<' '<<i;
- return 0;
- }
- for(int j=i+1;j<n;j++)
- {
- s+=a[j]%n;
- if(s%n==0)
- {
- cout<<i<<' '<<j;
- return 0;
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement