Skip to content

Instantly share code, notes, and snippets.

Cho trước 1 xâu. Viết function(tạm gọi là permAlone) liệt kê số các hoán vị của xâu sao cho không có 2 kí tự giống nhau đứng liền kề.
Ví dụ permAlone('aab') có các hoán vị (aab, aab, aba, aba, baa, baa) nhưng chỉ có 2 hoán vị đúng yêu cầu là (aba và aba).
Dữ liệu mẫu:
permAlone("aab") should return a number.
permAlone("aab") should return 2.
permAlone("aaa") should return 0.
permAlone("aabb") should return 8.
permAlone("abcdefa") should return 3600.
permAlone("abfdefa") should return 2640.
permAlone("zzzzzzzz") should return 0.
#include<iostream>
#include<math.h>
using namespace std;
int main() {
float so_do_do, so_do_radian;
cout << "Nhap so do do: "; cin >> so_do_do;
so_do_radian = so_do_do*M_PI/180;
cout << "So do radian la: " << sp_do_radian;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package project1;
/**
*
* @author Desktop
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package btvn3;
import javax.swing.JOptionPane;
/**
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package btvn1;
import java.util.Scanner;
/**
#include <winsock2.h>
#include <ws2tcpip.h>
#include <iostream>
#include <string>
#include <thread>
using namespace std;
#pragma comment (lib, "Ws2_32.lib")
#include <iostream>
#include <winsock2.h>
#include <ws2tcpip.h>
#include <string>
#include <thread>
#include <vector>
#pragma comment (lib, "Ws2_32.lib")
#define IP_ADDRESS "127.0.0.1"
<html>
<head>
<style>
table {
border-collapse: collapse;
}
table td {
color: blue;
}
</style>
@echo off
color 1e
:BEGIN
TITLE Phan mem tat may
Mode con: COLS=83 LINES=35
cls
echo.
echo. *****************************************************************************
echo. *****************************************************************************
echo. ***************************** Phan mem tat may *****************************
<!DOCTYPE html>
<html>
<head>
<script>
var i = 0;
function myFunction() {
var arr = ["https://scontent-hkg3-1.xx.fbcdn.net/v/t1.0-9/13614963_575086482664798_8883246360922577859_n.jpg?oh=b32359dce459fc119f53ddc98aeb0285&oe=57EB408A","https://scontent-hkg3-1.xx.fbcdn.net/v/t1.0-9/13614970_640455629436155_6508876143278195466_n.jpg?oh=feb612e4c3ff5a4a96b1f4483fc915e8&oe=582BAC5A"];
document.getElementById("myImage").src=arr[i];
i+=1;
}