luyencode / comments

Server lưu trữ bình luận trên Luyện Code
https://luyencode.net
6 stars 3 forks source link

https://oj.luyencode.net/problem/PALI #439

Open utterances-bot opened 3 years ago

utterances-bot commented 3 years ago

Chi tiết bài tập - Luyện Code Online

https://luyencode.net/problem/PALI

tuankietcoderr commented 3 years ago

Đây là lời giải của mình đã AC. Nếu bạn đã cố gắng mà chưa làm được thì có thể tham khảo lời giải của mình.

Xem code AC

``` #include using namespace std; int demso(int n){ int count=0; while(n>0){ n/=10; count++; } return count; } bool check(int n){ int a[10000],b[10000]; int i=0; for(;n!=0;){ a[i]=n%10; n/=10; i++; } int h=0; int count=0; for(int k=i-1;k>=0;k--){ b[h]=a[k]; h++; } for(int k=0;k>n; for(int i=0;i>a[i]; for(int i=0;i

link0707 commented 3 years ago

https://pastecode.io/s/vy5kb2wu Đây là cách giải của mình các bạn tham khảo nhé

ghost commented 3 years ago

Đây là lời giải của mình đã AC. Nếu bạn đã cố gắng mà chưa làm được thì có thể tham khảo lời giải của mình.

Xem code AC

```#include #include using namespace std; bool Palindrome(string s) { int i = 0, j = s.length() - 1; while (i < j) { if (s[i] != s[j]) return false; i++; j--; } return true; } int main() { int n; cin >> n; cin.ignore(); string* l = new string[n]; for (int i = 0; i < n; i++) { cin >> l[i]; } for (int i = 0; i < n; i++) { if (Palindrome(l[i])) cout << l[i] << " "; } return 0; }```

phanquocthien commented 2 years ago

Viết bằng python cứ bị time limit exceed

Xem code Python

```py arr=[] n=int(input()) arr = list(map(str,input().strip().split()))[:n] for i in range(n): if arr[i][::-1]==arr[i]: print(arr[i],end=" ") } ```

phanquocthien commented 2 years ago

21ms
30ms
22ms

MinhVy-PCB commented 2 years ago

Đây là lời giải của mình Code C. Nếu bạn đã cố gắng mà chưa làm được thì có thể tham khảo lời giải của mình.

Xem code AC

```cpp #include int main(){ int n; scanf("%d",&n); int a[100]; for(int i = 0; i < n; i++){ scanf("%d",&a[i]); } for(int i = 0; i < n; i++){ int kq = 0; int donvi; int tg = a[i]; while(tg > 0){ donvi = tg % 10; kq = kq*10 + donvi; tg = tg/10; } if(a[i] - kq == 0){ printf("%d ",a[i]); } } return 0; } ```

ghost commented 2 years ago

Nộp lần đầu thì bị TLE, nộp lần đầu AC ảo thật :))

NguyenKhacDuong01 commented 2 years ago

Code AC :)

Xem code AC

``` #include using namespace std; bool Num (string s) { string s1 = s; reverse(s.begin(),s.end()); if (s == s1) return 1; else return 0; } int main () { int t; cin >> t; vector v{t}; for (string x : v) { cin >> x; if (Num(x) == true) cout << x << " "; } } ```

shiinehata commented 2 years ago

*NOTE:

NguyenTrong17070 commented 2 years ago

https://luyencode.net/status/6ece1c05a142127e3199a51db6da2b6a?problem=PALI

DangLun commented 2 years ago

AC

Xem code AC

#include #define ll long long #define pb push_back #define pf push_front using namespace std; int kt(int n){ int res = 0; while(n != 0){ res = res * 10; int t = n%10; res += t; n/=10; } return res; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; for(int i = 0; i> x; if(kt(x) == x){ cout << x << " "; } } }

Sunflowerformylove commented 2 years ago

https://oj.luyencode.net/status/e4a0c2a1b125bc139589cf9b123d3b3a?problem=PALI

danh2006 commented 2 years ago

Đây là lời giải của mình đã AC. Nếu bạn đã cố gắng mà chưa làm được thì có thể tham khảo lời giải của mình.

Xem code AC

#include using namespace std; int demso(int n){ int count=0; while(n>0){ n/=10; count++; } return count; } bool check(int n){ int a[10000],b[10000]; int i=0; for(;n!=0;){ a[i]=n%10; n/=10; i++; } int h=0; int count=0; for(int k=i-1;k>=0;k--){ b[h]=a[k]; h++; } for(int k=0;k>n; for(int i=0;i>a[i]; for(int i=0;i

hoangdev0 commented 2 years ago

Đây là lời giải của mình đã AC. C++.

Xem code AC

```c++ #include #define fast() ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0) using namespace std; bool k(int n) { int x(0), s(n); while (n > 0) { x = x * 10 + n % 10; n/=10; } return x == s; } int main() { fast(); int n,x; cin >> n; while (n--) { cin >> x; if(k(x)) cout << x << " "; } return 0; } ```

ghost commented 1 year ago

https://oj.luyencode.net/status/e534575d2109a4893439c0fb8cb7f944?problem=PALI

nguyenanhquan2009 commented 1 year ago

1ms 0ms 1ms