Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int n,c[1000]={},rest[1000]={},r=0;
- ifstream f("camioane.in");
- ofstream g("camioane.out");
- long long Pow(long long a, long long b,int n) {
- long long ans = 1;
- while(b)
- if(b & 1) ans *= a, ans %= n, --b;
- else a *= a, a %= n, b /= 2;
- return ans;
- }
- void constr(int c[],int n){
- //c[]
- }
- int main()
- {
- int nr_inc, prima_inc;
- f>>n;
- for(int i=1;i<=n;i++){
- f>>c[i];
- }
- for(int i=1;i<=n;i++){
- r = (r+c[i])%n; ///sume part
- /// cout<<i<<" r="<<r<<endl;
- if(r==0){
- for(int k=1;k<=i;++k){
- g<<k<<" ";
- return 0;
- }
- }
- else{
- if(rest[r]!=0){
- nr_inc =i-rest[r];
- prima_inc =rest[r]+1;
- for(int j=1;j<=nr_inc;j++){
- g<<prima_inc + j -1<<" ";
- }
- return 0;
- }
- else{
- rest[r]=i;
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement