Submission #1115068

# Submission time Handle Problem Language Result Execution time Memory
1115068 2024-11-20T01:26:59 Z monaxia Prosjek (COCI14_prosjek) C++17
50 / 50
1 ms 348 KB
#include <bits/stdc++.h>
#define pb push_back
#define ppb pop_back
#define fr first
#define sc second
#define all(v) v.begin(), v.end()
#define mod (long long)(1e9 + 7)
#define eps (long long)(1e-9)
#define vektor vector
using namespace std;
 
using ll = long long;
using ull = unsigned long long;
using ld = long double;

const unsigned Mod = 1e9 + 7;

void solve(){
    ll n;
    cin >> n;

    vector <ll> ans(n + 1), a(n + 1);

    for(int i = 1; i <= n; i ++){
        cin >> a[i];
        // if(i == 1) ans[i] = a[i];
        // else
         ans[i] = (a[i] - a[i - 1]) * (i - 1) + a[i];

        cout << ans[i] << " ";
    }
}
 
signed main()
{
    // cin.tie(0)->sync_with_stdio(0);
 
    if(fopen("blank.inp", "r")){
        freopen("blank.inp", "r", stdin);
        freopen("blank.out", "w", stdout);
    }
    
    // // cout << 1; return 0;
 
    ll n = 1;
 
    // cin >> n;

    while(n) {
        solve();
        n --;
        cout << "\n";
    }
 
    // cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
}

//                                   ++++                                           
//                          ++++-::......:--:::-=+++                                
//                    ++++=:............---.....--:..:=++++++                       
//                    +++++++::......................::=+++++                       
//             @@               ++++++++++:+++++++++                                
//             @%                                  @*                               
//              %%@@                    *****#*@@                                   
//             %%%%%                  @##**##***%                                   
//           @@@@@@+-*#*@             #####%+*##*@                                  
//                  %#+@%%@@@         ##-%:::-#*###@@                               
//                 =====:*:::        ###-:==::=#*%*                                 
//                    -====:::::+@@%@@%@#*--=*#%%#@%@   @%@                         
//                        @=====%=-@%=:::.:+-::::+::::::::::::%-----%% @@@@@        
//                        @@%#*@++%===+::-================@%@@@@+++++++@@@%%%@#%###%
//               @#***#@@   @##=%@===+--:+==+===+%*##@%%%@@@@@@@@@@:=  @%@%%%@#%%   
//    -@      @*#@         #####%:::-====+:::==---**%#@ *%%%%@@@@@@-:               
//    -=-*%  #          #***--%%::::::::+=-+#-----=**@*#     #+**#@#                
//     ----=----#+****=----=*#@=::::::=#-----------***%*%                           
//      ------------%*****##=@==::::::+%-----------***%**                           
//       +-----------------*@++%::::::::-----------****@*#                          
//         =------------% @%=+%#+:::::::* #-----*--**** **                          
//            ----%--%    *==+++++=+=##*:%   ---=--**** **                          
//                       %@@@@@@@@@==@+%%%%@   ----**** *#                          
//                     @=*+%@@@%@@=++=:%:::%      #***@@#                           
//                    #+++++++++#==++-::::::     @**** *#                           
//                   =+++++++++++==+++:::::::   ####@ #%                            
//                  +++++++++++=@ @++++::::::@      @#                              
//                 @+++++++++=@    =*++=:::::@                                      
//                 ++++++++@       @++++:::::                                       
//                ++++++=           =++++:::                                        
//               =+++++@             =+++::::                                       
//             ++++++-@               =+++:+::                                      
//           @::+::::@                 =++::-:::                                    
//          +::=:::::                  @+*+:-+++-:                                  
//        @::+-:::::#                     +++::::::@                                
//       ::%=:::::::%@                    @%++::::***                               
//     @:+@*:::::::****@                   +@+++:-=*:*@                             
//    *:@@%::::::::=****                   @%@+++:::#**@                            
//   *%@@@-:::::::%=+==*@                   +@%+++:***+*                            
//  #%@@%%::::::::#+=-=#                    =+@+++++:::*+                           
// @####+::::::::%+=@#%#=@                  @**@@%=++::::@                          
// @   +:::::::::***#*@ @@###+=+=%@          +**#+=+*+:::-                          
//    =-:::::::%%%%@@          @#=*########%#+*%%+--@*+::%                          
//   +---%@                                   @@ =-:-**:#                           
//  %%%%%                                        @+--*@                             
// @%%%%@                                        @%%%%%                             
//                                                @%%@@

Compilation message

prosjek.cpp: In function 'int main()':
prosjek.cpp:39:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   39 |         freopen("blank.inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
prosjek.cpp:40:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   40 |         freopen("blank.out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct